web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

Retrieve and update a number in an excel cell

(0) ShareShare
ReportReport
Posted on by 38

Hello All

 

I want to fill a label in PowerApps with the value from 1 cell in an Excel worksheet, I also want to be able to update that one cell in the worksheet with a click on a button in PowerApps. Is this possible?

2019-10-27 21_43_29-Clipboard.png

 

 

I have the same question (0)
  • mdevaney Profile Picture
    29,987 Moderator on at
    Re: Retrieve and update a number in an excel cell

    @Flowbginner 

    Yes, you can do this.  Take a look at my table below.  There are two columns ID and Value.  Every value you want to call from the table must have a unique ID.  In this case the unique ID is 1.

     

    imgZ1.png

     

    Create a new label and change the Text property to the following code.

     

    LookUp(
     your_datasource_name,
     ID=1,
     Value
    );

     

    The label will now display this

     

    50

     

    To update the number in your Excel spreadsheet you'll have to create 2 new controls: a Text Input (TextInput1) and a Button (Button1).

     

    imgZ2.png

     

    To update the value in your spreadsheet we must tell PowerApps what to do when the button is clicked.  Put the following code in the OnSelect property of the Button.

     

    Patch(
     your_datasource_name,
     LookUp(your_datasource_name,ID=1),
     {Value: TextInput1.Text}
    );

     

    Write a number in the Text Input and click the button.  It will update the value in your spreadsheet.  If you want the change to be immediately reflected in your label make sure to Refresh the datasource.

     

    Patch(
     your_datasource_name,
     LookUp(your_datasource_name,ID=1),
     {Value: TextInput1.Text}
    );
    Refresh(your_datasource_name);

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

     

     

     

  • Flowbginner Profile Picture
    38 on at
    Re: Retrieve and update a number in an excel cell

    When inserting the first formula I receive this error: "Incompatible type. We can't evaluate your forumula because the values being compared in the forumla aren't the same type." 

    2019-10-28 09_25_26-Search.png

    Is there something I must configure in the Excel sheet besides selecting A1:B2 and insert table?

    2019-10-28 09_57_20-Clipboard.png

  • v-monli-msft Profile Picture
    on at
    Re: Retrieve and update a number in an excel cell

    Hi @Flowbginner ,

     

    Try to use below formula instead in the text control:

    LookUp(
     your_datasource_name,
     ID=1,
     Value
    ).Value

    Regards,

    Mona

  • Flowbginner Profile Picture
    38 on at
    Re: Retrieve and update a number in an excel cell

    Does not resolve it:

    2019-10-28 11_12_00-Search.png

     

  • Flowbginner Profile Picture
    38 on at
    Re: Retrieve and update a number in an excel cell

    @mdevaney  The second formula also doesn't work 😞

    2019-10-28 11_59_12-Start.png

  • mdevaney Profile Picture
    29,987 Moderator on at
    Re: Retrieve and update a number in an excel cell

    @Flowbginner 

    PowerApps is probably treating the ID as Text where I had expected a number.  Please put some quotation marks aroud the "1" and tell me if it works.

     

    Patch(
     your_datasource_name,
     LookUp(your_datasource_name,ID="1"),
     {Value: TextInput1.Text}
    );

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • Flowbginner Profile Picture
    38 on at
    Re: Retrieve and update a number in an excel cell

    @mdevaney  the errors in the formula's are gone, but I still don't see output in the label...

  • mdevaney Profile Picture
    29,987 Moderator on at
    Re: Retrieve and update a number in an excel cell

    @Flowbginner 

    Some questions for you...

    • Did you have any text in TextInput1 when you pressed submit?
    • Does the new text appear in your Excel spreadsheet?
    • Did you add the line of code that says Refresh(your_datasource_name)?
    • What appears if you put this code in another label?     

     

    LookUp(your_datasource_name,ID="1",ID)

     

  • Flowbginner Profile Picture
    38 on at
    Re: Retrieve and update a number in an excel cell

    @mdevaney 

    • Did you have any text in TextInput1 when you pressed submit?
      • Yes
    • Does the new text appear in your Excel spreadsheet?
      • No
    • Did you add the line of code that says Refresh(your_datasource_name)?
      • Yes
    • What appears if you put this code in another label? 
      • Same issue
  • mdevaney Profile Picture
    29,987 Moderator on at
    Re: Retrieve and update a number in an excel cell

    @Flowbginner 

    There are two possibilities:

    1. You added a new column to your spreadsheet but did not refresh your data source.  This is necessary to add new columns.  Go to the Left-side menu, click on the Table datasource and click Refresh.

    2.  The lookup function is not finding the record.  Please share a screenshot of the datatable in your spreadsheet.

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 629 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 397 Super User 2025 Season 2

#3
wolenberg_ Profile Picture

wolenberg_ 232 Moderator

Last 30 days Overall leaderboard