cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

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
Highlighted
Community Support
Community Support

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.

View solution in original post

5 REPLIES 5
Highlighted
Community Support
Community Support

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.
Highlighted
Frequent Visitor

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

 

Highlighted
Community Support
Community Support

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.

View solution in original post

Frequent Visitor

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

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

 

Regards

Andrew

Highlighted
Community Support
Community Support

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
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (9,404)