Power Apps Save Collection to SharePoint List

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:

  1. Set up a SharePoint Online list
  2. Create a Blank canvas app and connect it to the SharePoint list
  3. Create Power Apps collection manually
  4. 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 NameData Type
ProductNameIt is a default single line of text column
OrderDateDate and time
PriceCurrency

Refer to the below image:

Power Apps Save Collection to SharePoint List

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.
Power Apps Save Collection to SharePoint Online List
  • Then, connect the canvas app to the respective SharePoint list [Orders List] as in the screenshot below
Power Apps Save Collection to the SharePoint List

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.
How to Submit Power Apps Collection to SharePoint List
  • 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,

  1. Collect() = This function is used to add records to a data source or table
  2. colOrders = Power Apps collection name
  3. ProductName, OrderDate, Price = Collection headers/columns
  4. TextInput_ProductName, TextInput_Price = Power Apps text input controls
  5. DatePicker_OrderDate = Date picker name
How to Save Power Apps Collection to the SharePoint List
  • 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.
How to Save  Power Apps Collection to SharePoint List

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,

  1. Patch() = This function allows us to create and modify records in a data source
  2. ‘Orders List’ = SharePoint Online List
  3. Defaults() = This function returns a record that contains the default values for the data source
  4. Title, OrderDate, Price = SharePoint list fields
  5. First() = This function returns the first record of a table
  6. LastN() = This function returns the last record of a table
  7. colOrders = Power Apps Collection
  8. Reset() = The Reset function resets a control to its Default property value
Save Power Apps Collection into the SharePoint list
  • 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.
See also  PowerApps Search User

Refer to the below Screenshot:

Save Power Apps Collection into SharePoint list

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:

>