cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
agaskelluk
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

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
v-yutliu-msft
Community Support
Community Support

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.

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

 

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

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

 

Regards

Andrew

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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (72,994)