cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
agaskelluk
Level: Powered On

Import data from Excel or CSV and Update SharePoint List

Hi all

I have rows of data in an excel file and I would like to update my SharePoint List with the contents of this file using Powerapps.

 

I am able to connect to the excel file as a datasource in Powerapps using the OneDrive for Business Data Source, but I am struggling with how to push this data to my SharePoint List. I can't easily do a Collect or Patch because there are some complex datatypes in the SharePoint List like Choice and Lookup for which I cannot know the iterator.

 

e.g. I have fields called "ChoiceField", "NumberField", "TextField", "Title", "YesNoField" in my excel file and a SP List with the same names. 

 

What is the best way to update my SP List? 

 

Thanks

Andrew

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Import data from Excel or CSV and Update SharePoint List

Hi @agaskelluk ,

1)Yes. I'm afraid it's not supported to save data from excel to SharePoint directly in PowerApps currently. You need collection as a temporarily stored place.

 

2)Yes. I've made a similar test, this is the best way.

Here's formula that I tried:

ForAll(c,Patch(Table1,Defaults(Table1),{jus:If(Column1="Yes",true,false)}))

 

3)I've made a similar test but not found the problem as your description.

Whether using DateValue is determined by the format of the filed in Excel.

If the data in Excel is already formatted to datevalue, you could use myDateTime directly.

If the data in Excel is just a text value, you need to use DateValue(myDateTime).

 

Best regards,

Community Support Team _ Phoebe Liu

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
5 REPLIES 5
Community Support Team
Community Support Team

Re: Import data from Excel or CSV and Update SharePoint List

Hi @agaskelluk ,

Do you want to write data in excel to sharepoint list?

I've made a similar test for your reference:

1)create connection with the excel file(one drive) and sharepoint list

2) save the data in excel as a cllection:

ClearCollect(Data1,tablename)

2)update data:

ForAll(Data1,Patch(listname,Defaults(listname),
{textfield:textfield,choicefield:{Value:choicefield},datefield:datefield,
numberfield:Value(numberfield),lookupfield:LookUp(Choices(listname.lookupfield),Value=lookupfield)}
)
)

I use some special data types as example, like text type,choice type, date type, number type, look up type.

 

 

Here's a doc about creating multiple records at once:

https://powerapps.microsoft.com/en-us/blog/bulk-update-using-forall-and-patch/

Here's a doc about defining special data type in sharepoint:

https://powerapps.microsoft.com/en-us/blog/default-values-for-complex-sharepoint-types/

 

 

 

Best regards,

Community Support Team _ Phoebe Liu

 

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
agaskelluk
Level: Powered On

Re: Import data from Excel or CSV and Update SharePoint List

Hi @v-yutliu-msft 

That was extremely useful and helped me solve this. Thanks so much!

 

Here are some additional observations and questions however:

 

1) Do I really need to create a collection? Can't I access the data directly from the excel datasource ie 'tablename'?

2) I handled booleans like this, I don't know if there is a better way:

Conversion: If(
Conversion = "Yes",
true,
false
)

3) I had some odd behaviour with DateTime fields in the SP List. I have three DateTime Fields. The first is required the others are not. The one that is required got interpreted by PowerApps as a text field, so I could do this:

myDateTime: myDateTime

but the other two needed a cast like this:

myDateTime: DateValue(myDateTime)

 

Thanks

Andrew

 

Community Support Team
Community Support Team

Re: Import data from Excel or CSV and Update SharePoint List

Hi @agaskelluk ,

1)Yes. I'm afraid it's not supported to save data from excel to SharePoint directly in PowerApps currently. You need collection as a temporarily stored place.

 

2)Yes. I've made a similar test, this is the best way.

Here's formula that I tried:

ForAll(c,Patch(Table1,Defaults(Table1),{jus:If(Column1="Yes",true,false)}))

 

3)I've made a similar test but not found the problem as your description.

Whether using DateValue is determined by the format of the filed in Excel.

If the data in Excel is already formatted to datevalue, you could use myDateTime directly.

If the data in Excel is just a text value, you need to use DateValue(myDateTime).

 

Best regards,

Community Support Team _ Phoebe Liu

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
agaskelluk
Level: Powered On

Re: Import data from Excel or CSV and Update SharePoint List

@v-yutliu-msft That's great, thank-you.

 

Regards

Andrew

Community Support Team
Community Support Team

Re: Import data from Excel or CSV and Update SharePoint List

Hi @agaskelluk ,

Do you have other questions?

If your problem has been solved, please mark my answer.

Thanks!

 

Best regards,

Community Support Team _ Phoebe Liu

Community Support Team _ Phoebe Liu
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: 291 members 4,378 guests
Please welcome our newest community members: