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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Retrieve and update a ...
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

 

 

Categories:
I have the same question (0)
  • mdevaney Profile Picture
    29,989 Moderator on at

    @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

    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

    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

    Does not resolve it:

    2019-10-28 11_12_00-Search.png

     

  • Flowbginner Profile Picture
    38 on at

    @mdevaney  The second formula also doesn't work 😞

    2019-10-28 11_59_12-Start.png

  • mdevaney Profile Picture
    29,989 Moderator on at

    @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

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

  • mdevaney Profile Picture
    29,989 Moderator on at

    @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

    @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,989 Moderator on at

    @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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 757 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 322 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 209 Super User 2025 Season 2

Last 30 days Overall leaderboard