cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
SquawkingGoat
Level: Powered On

Patch Input Data from Gallery to Excel File

Hey all!  I'm fairly new to PowerApps, but I've watched tons of videos and I've used Excel for years. 

 

I've created a Gallery that pulls the fields from an excel file on OneDrive.  I want users to be able to input the Qty into each text box and then when they hit the save button, it saves the values back to the excel file.  I've tried different iterations of Patch and ForAll and I can't seem to get it to work. 

 

Can anyone guide me in the right direction?  "SpringTbl" is the excel table name.  "2 - Qty" is the column of data I want to update.

 

Screen Shot 2019-08-23 at 4.29.18 PM.png

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Patch Input Data from Gallery to Excel File

Hey @SquawkingGoat, maybe try the following:

 

 

ForAll(
    Gallery1.AllItems,
    Patch(
        SpringTbl,
        LookUp(SpringTbl, Size = SizeLabel.Text && Length = LengthLabel.Text && Color = ColorLabel.Text),
        {'2 - Qty': TextInput1.Text}
    )
)

where Size, Length, and Color are the column names for those items in SpringTbl and SizeLabel, LengthLabel, and ColorLabel are the names of the text labels in Gallery1 for those items.

 

 

Just to attempt to clarify what is happening a bit, that second part of the Patch function needs to be a single record so we need a way to identify each individual row in the table. If you had an ID in that table, we could reduce that statement to something like:

ForAll(
    Gallery1.AllItems,
    Patch(
        SpringTbl,
        LookUp(SpringTbl, ID = Value(IDLabel.Text)),
        {'2 - Qty': TextInput1.Text}
    )
)

where IDLabel is a text label in the gallery, either shown or hidden. 

 

Please let me know if I can explain anything else or attempt to help further!

View solution in original post

2 REPLIES 2
Super User
Super User

Re: Patch Input Data from Gallery to Excel File

Hey @SquawkingGoat, maybe try the following:

 

 

ForAll(
    Gallery1.AllItems,
    Patch(
        SpringTbl,
        LookUp(SpringTbl, Size = SizeLabel.Text && Length = LengthLabel.Text && Color = ColorLabel.Text),
        {'2 - Qty': TextInput1.Text}
    )
)

where Size, Length, and Color are the column names for those items in SpringTbl and SizeLabel, LengthLabel, and ColorLabel are the names of the text labels in Gallery1 for those items.

 

 

Just to attempt to clarify what is happening a bit, that second part of the Patch function needs to be a single record so we need a way to identify each individual row in the table. If you had an ID in that table, we could reduce that statement to something like:

ForAll(
    Gallery1.AllItems,
    Patch(
        SpringTbl,
        LookUp(SpringTbl, ID = Value(IDLabel.Text)),
        {'2 - Qty': TextInput1.Text}
    )
)

where IDLabel is a text label in the gallery, either shown or hidden. 

 

Please let me know if I can explain anything else or attempt to help further!

View solution in original post

Community Support Team
Community Support Team

Re: Patch Input Data from Gallery to Excel File

Hi @SquawkingGoat ,

Based on the needs that you mentioned, I think the ForAll function and Patch function could achieve your needs.

 

Based on the formula you provided, I think this is something wrong with it. I have made a test on my side, please take a try with the following workaround:

Set the OnSelect property of the "Save" icon button to following formula:

ForAll(
        Gallery1.AllItems,
Patch(
SpringTbl,
LookUp(SpringTbl, Size = SizeColumn.Text && Length = LengthColumn.Text && Color = ColorColumn.Text),
{
'2 - Qty': TextInput1.Text
}
) )

Note: The Size, Length and Color are all columns in your SpringTbl Excel table.

 

Please take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (7,100)