In this article, we are going to see how to use the patch function to create and edit multiple records in a table.
Create Multiple Records Using Patch Function
Syntax
Patch(Datasource, BaseRecordsTable, NewRecordsTable)
Code
ClearCollect(
colGrosseryInventory,
Table(
{
Name: "Pasta",
ProductID: 1001,
ExpiryDate: Date(2023,12,11),
Price: 120
},
{
Name: "Rice",
ProductID: 1002,
ExpiryDate: Date(2024,12,08),
Price: 110
},
{
Name: "Butter",
ProductID: 1003,
ExpiryDate: Date(2025,12,07),
Price: 130
}
)
);
Patch(
GrosseryInventory,
ForAll(
Sequence(CountRows(colGrosseryInventory)),
Defaults(GrosseryInventory)
),
colGrosseryInventory
);
Output
GrosseryInventory in SharePoint.
| ID | Name | ProductID | ExpiryDate | Price |
| 10 | Pasta | 1001 | 12/01/2023 | 120 |
| 11 | Rice | 1002 | 08/01/2024 | 110 |
| 12 | Butter | 1003 | 07/11/2025 | 130 |
Edit Multiple Existing Records Using Patch Function
Syntax
Patch(Datasource, BaseRecordsTable, UpdateRecordsTable)
Code
ClearCollect(
colUpdateGrosseryInventory,
Table(
{
ID: 10,
Price: 140
},
{
ID: 11,
ExpiryDate: Date(2024,12,11),
Price: 130
},
{
ID: 12,
Price: 160
}
)
);
Patch(
GrosseryInventory,
ShowColumns(
colUpdateGrosseryInventory,
"ID"
),
colUpdateGrosseryInventory
);
Output
GrosseryInventory in SharePoint.
| ID | Name | ProductID | ExpiryDate | Price |
| 10 | Pasta | 1001 | 12/01/2023 | 140 |
| 11 | Rice | 1002 | 12/11/2024 | 130 |
| 12 | Butter | 1003 | 07/11/2025 | 160 |
That’s it, you have seen how to use the patch function to create and edit multiple records in a table. Feel free to fill up the comment box below if you need any further assistance.

Join the conversation! Your thoughts help the community grow.