Upload & Update Excel Values to SharePoint List

A Flow uploading Excel sheet values to SharePoint is useful, but nicer if it can Update too. This Flow achieves that.

Upload & Update Excel Values to SharePoint List

A few months ago I posted a video showing a Flow that uploads values from Excel into a SharePoint list. It turned out a few people wanted to do this and found it useful. However they wanted the Flow to be a bit more CRUD capable, i.e. to update existing items. As such I've reworked the Flow to do Updates as well.

So, on a recurrence trigger the Flow is pulling some values from an Excel;

The excel is this example is simple, but to enable Updates it needs a unique key. All my Title values are unique in this example;

The key to the exercise is to do a check whether an item in the Excel exists before trying to write it. So I have to do a GetItems with an ODATA query matching the TITLE in Excel to the Title in SharePoint. This has two benefits in that I know whether to Update or Create a new item depending on the result, but also if it finds a list item I get hold of the internal SharePoint ID which I need.

The tricky bit for the Flow was the conditional statement. When I built it using the editor it got wrapped in another Apply To Each block automatically which broke it!

So doing it in Advanced mode with the following expression to check Empty or not is better. The expression is @empty(body('Get_items')?['value'])

If it's empty you go to Yes and you're creating a new list item in SharePoint to store the Excel value;

However with a result in the Condition that means you're doing an Update;

The item ID came from the GetItems query way back.

Running this Flow for the first time gives me the initial values;

Changing the value in Test4 to CHANGE and running the Flow again it is successfully updated;

Disclaimer: The software, source code and guidance on this website is provided "AS IS"
with no warranties of any kind. The entire risk arising out of the use or
performance of the software and source code is with you.

Any views expressed in this blog are those of the individual and may not necessarily reflect the views of any organization the individual may be affiliated with.