Showing results for 
Search instead for 
Did you mean: 
Helper III
Helper III

(important) using custom button to insert data to excel database

picture 1picture 1picture 2picture 2picture 3picture 3

hello guys, really need help ASAP . Smiley Sad

I'm making a rating apps. as shown in picture above.

The problem is when start to rate the user will rate base on choosing team, and select the creteria given by clicking the emoji button..... When the user click the emoji button the value goes in excel but not in a same row (refer picture 3) and the team name value still null.. The command that I use for emoji can refer(picture 1, picture 2)


Example... I want to make is 1 user goes in rate team(dropdown menu), click the emoji button innovation/experience/impact/collaboration/quality will goes in same ROW inside excel


thank you



Accepted Solutions

If you click any of the icons (you can do that while in preview mode, as it's easier to really click the icon without selecting it), then it will set the variable corresponding to the row that you click (innovation, experience, impact, ...). When the variable value is changed, then all formulas that reference that variable are recalculated.


So if you click on the "poor" icon for the innovation row, it will set the value of that variable to "poor", and you'll see the icon changing color.

View solution in original post

Power Participant
Power Participant

You're using Patch with the Default-function as second parameter, and then you create a new record, every time. So the formula works as you have written it.


To update a record, you have to have have the base record to change. Maybe you can get it from the selected item in the drop down; what's the Items property of it? Where do you get the team name from? In the excel file, no team name is set.


Read more about Patch here:

thank you @BitLord69 for the reply..


May I know which patch function should I used?

can you give 1 examples for one button(emoji)


Patch( Table1_1, Defaults( Table1_1 ), {NAME: User().FullName, INNOVATION: "Poor" } ) 

which part should I change in my code(code above)?

my data name : Table1_1


For the team name.., if user select in dropdown menu the value will go inside excel... I already put in Item list as shown below:-

["Team one","Team two","Team three","Team four","Team five"]




As I wrote in the first reply, you have to replace the Defaults-funciton and somehow get the currently edited record. When you use Defaults you create a new record. So, assuming there will be only one record per user you can do a Lookup to get the record to Patch:


Patch(Table1_1, Lookup(Table1_1, NAME=User().FullName), {...})


It seems this is the second screen in the app - how do you choose which user to rate and get to the second screen?

If the user doesn't have a record already, you have to create one using a call to Patch like you're already doing.


Tip - on app start, you might also want to set a global variable to the current user so you don't have to call the User-function all the time, i.e. Set(rCurrentUser, User()) and then you can use that variable in the formula above.


Another tip - if you're going to have lots of data you might want to look into saving in a proper database. Excel is good at many things, but it's not really a database. 


Good luck!


I already using that code in picture above but no data go inside excel.



my first page only have one button to navigate to this rating page 

You want the user to select all of the ratings before submitting, then you shouldn't use the Patch command in the images themselves. Instead, you can have some visual indication of what the user chose, and on the "check" icon on the top-right of your screen you can gather all the ratings for the different categories and create a new record (line) in your table.


An example is on the app shown below. Instead of having a single image for each rating, I have two versions: one with colors and one black-and-white (you may want to have different images instead of different colors as well, to account for users that need high-contrast displays)




In each of the images, it sets the corresponding variable (innovation, experience, impact, collaboration, quality) to the rating value. The Image property of the image object uses the If function to decide which version of the image to use. For example, in the top-left image (poor, innovation), the Image property is set to


If(innovation = "poor", poor, 'poor-bw')

And the OnSelect is set to


UpdateContext({innovation:If(innovation = "poor", Blank(), "poor")})


When the user has selected all the ratings, he/she can then click the check box to submit the ratings, in which case the Patch command would use the value of all the variables to create the new row.


You can find one version of this app at!AonXZuy7S5iZiZ1Op9ZmbA8-6HuAbg. Notice that you'll need to update the connection to your own Excel table to make this work.



 when I change it become like this 



The emoji is image from outside not insert icon available in powerapps


Yes, you'll need to have the different images. I searched for a website that could make B&W version of the images and converted them myself, and added them to the app. Feel free to save those (below) locally (naming them appropriately), and add them to your app.




that mean I have to upload the B&W version on page and put at the color icon location overlap ? or only use the B&W emoji and use the code ?



then how about to insert the value like (poor,average,good,awesome) value inside excel row ?

You'll need to upload the BW version of the files, but you don't need to use a different Image control - by setting the If expression that I mentioned above in the Image property of that control, you can choose between the two images depending on the value of the property.


And you'd insert the value in the "submit" button (in this case, the "check" icon on the top-right corner of the screen). The formula for it would be something along the lines of

        NAME: TextInput1.Text,
        'TEAM_x0020_NAME': Dropdown1.Selected.Value,

Please download the app that I shared and look at it; you should see the formulas that are used to make this logic work.

Helpful resources

UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,792)