How to Update SharePoint List Items Separately from a Power Apps Gallery
Question details
The user needs to properly update individual SharePoint list items from a Power Apps gallery without overwriting all items with the last gallery item's values.

- Product
- Power Apps
- Device & OS
- not provided
- Scenario
- Using a ForAll and Patch formula in Power Apps to push multiple updates from a gallery to a connected SharePoint list.
- Observed behavior
- The formula incorrectly updates every SharePoint list item with the value taken exclusively from the last item in the Power Apps gallery.
Verify that you have Edit permissions for the canvas app in Power Apps and that the connected SharePoint list allows data modification.
Correct the ForAll and Patch Formula Context
Adjust your formula using the 'As' operator to ensure each gallery item's unique identifier and field values are correctly referenced within the current record context.
When using the ForAll function in Power Apps alongside Patch, a common mistake is losing the context of the current record. Without disambiguation, Power Apps defaults to grabbing the value of the last processed item in the gallery and applying it to all patched records.
Open your Power Apps canvas app and locate the button or control that triggers the Patch function. Note the exact name of your gallery (e.g., Gallery1) and the SharePoint list.
Modify your ForAll formula to define a clear context for the gallery records. Use the syntax: ForAll(Gallery1.AllItems As GalItem, Patch(YourSharePointList, LookUp(YourSharePointList, ID = GalItem.ID), {YourColumn: GalItem.YourControl.Text}))
Ensure that the LookUp function inside your Patch statement is accurately matching the SharePoint list's unique ID with the specific gallery item's ID (GalItem.ID) so that only the corresponding row is updated.

Boost Your Daily Productivity with WPS Office
While Microsoft Power Apps handles complex custom application development, managing exported SharePoint data, local spreadsheets, and daily reports requires a fast, reliable office suite. WPS Office is a completely free, lightweight alternative to Microsoft Office that easily handles all your document needs.
- 1. Download and Install: Visit the official WPS website to download and install the free WPS Office suite.
- 2. Export SharePoint Data: Export your complex SharePoint list data to a CSV or Excel format for local review.
- 3. Open and Analyze in WPS Spreadsheet: Launch WPS Spreadsheet to open your exported data and perform advanced analysis with full Microsoft Excel formula compatibility.

Frequently Asked Questions
Why does my Power Apps Patch function overwrite all SharePoint records with the same value?
This happens when the ForAll loop lacks proper record context. If you do not use the 'As' operator or the [@DataSource] disambiguation syntax, Power Apps loses track of the current row and applies the value from the last evaluated control in the gallery to every patched record.
Can I use UpdateIf instead of ForAll and Patch to modify multiple list items?
Yes, the UpdateIf function can be used to bulk update multiple records in a SharePoint list that meet a specific condition. Depending on your data structure, UpdateIf can sometimes be more efficient than looping through a gallery with ForAll.
How do I get further help with complex Power Apps formulas?
For highly customized app logic and formula troubleshooting, it is highly recommended to post your exact code, data source structure, and expected behavior in the official Power Apps Community forums where Microsoft MVPs and experts can provide tailored solutions.




