cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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!

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!

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
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 186 members 5,291 guests
Recent signins:
Please welcome our newest community members: