Do you know how to save the Power Apps collection to a SharePoint list? No worries! Follow this Power Apps tutorial to learn everything on Power Apps save collection to a SharePoint list.
Power Apps Save Collection to SharePoint List
Let’s take a simple scenario to workaround with this:
- Set up a SharePoint Online list
- Create a Blank canvas app and connect it to the SharePoint list
- Create Power Apps collection manually
- Submit the Power Apps collection to the SharePoint list
1. Set up a SharePoint Online list
- I have created a SharePoint Online list, i.e., [Orders List], containing the below fields.
Column Name | Data Type |
ProductName | It is a default single line of text column |
OrderDate | Date and time |
Price | Currency |
Refer to the below image:
2. Create a Blank canvas app and connect it to the SharePoint list
- Open Power Apps with your respective Microsoft credentials -> Create a Blank canvas app [App name -> Format -> Create] as shown below.
- Then, connect the canvas app to the respective SharePoint list [Orders List] as in the screenshot below
3. Create Power Apps collection manually
- On the Power Apps Screen -> Insert two Text inputs, i.e., [TextInput_ProductName and TextInput_Price] and a DatePicker control [DatePicker_OrderDate] as shown below.
- Then, insert a Button control [btn_Submit] and set its OnSelect property to the code below.
OnSelect = Collect(
colOrders,
{
ProductName: TextInput_ProductName.Text,
OrderDate: DatePicker_OrderDate.SelectedDate,
Price: TextInput_Price.Text
}
);
Where,
- Collect() = This function is used to add records to a data source or table
- colOrders = Power Apps collection name
- ProductName, OrderDate, Price = Collection headers/columns
- TextInput_ProductName, TextInput_Price = Power Apps text input controls
- DatePicker_OrderDate = Date picker name
- Save, Publish, and Preview the app. When a user clicks the button control after providing the Product’s information, it will be stored in the Power Apps collection as in the screenshot below.
4. Submit Power Apps collection to the SharePoint list
- Now, I want to submit data from the Power Apps collection into the SharePoint list, to do so, select the button control and set its OnSelect property to the code below.
OnSelect = Collect(
colOrders,
{
ProductName: TextInput_ProductName.Text,
OrderDate: DatePicker_OrderDate.SelectedDate,
Price: TextInput_Price.Text
}
);
Patch(
'Orders List',
Defaults('Orders List'),
{
Title: First(
LastN(
colOrders,
1
)
).ProductName,
OrderDate: First(
LastN(
colOrders,
1
)
).OrderDate,
Price: First(
LastN(
colOrders,
1
)
).Price
}
);
Reset(TextInput_ProductName);
Reset(DatePicker_OrderDate);
Reset(TextInput_Price)
Where,
- Patch() = This function allows us to create and modify records in a data source
- ‘Orders List’ = SharePoint Online List
- Defaults() = This function returns a record that contains the default values for the data source
- Title, OrderDate, Price = SharePoint list fields
- First() = This function returns the first record of a table
- LastN() = This function returns the last record of a table
- colOrders = Power Apps Collection
- Reset() = The Reset function resets a control to its Default property value
- Once your app is ready, Save, Publish, and Preview the app. Whenever the user submits the Power Apps collection data by clicking the button control, it will be saved in the SharePoint Online list.
Refer to the below Screenshot:
This is all about the Power Apps save collection to the SharePoint Online list.
Conclusion
I hope you learned in detail about the Power Apps save collection to a SharePoint Online list from this Microsoft Power Apps tutorial.
You may also like:
- Remove Items From Power Apps Collection
- How to Count Rows in Power Apps Collection?
- How to Sort Power Apps Collection Alphabetically?
- Display Power Apps Collection on Gallery
- Add Column in Power Apps Collection
I am Bijay a Microsoft MVP (10 times – My MVP Profile) in SharePoint and have more than 17 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com