web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Overwrite SharePoint l...
Power Automate
Unanswered

Overwrite SharePoint list instead of appending

(0) ShareShare
ReportReport
Posted on by 163
Hi All,
 
I have a flow that extracts data from a CVS file, saved to SharePoint, that I want to export to a SharePoint List.
I have been able to accomplish this, however, when I run the flow again with updated data in the CVS, the data appends to the existing List. 
I would prefer to overwrite the list with the new data.
Can this be accomplished? Unless, of course, there is a better/smarter way :-)
 
Thank you
Categories:
I have the same question (0)
  • Verified answer
    Mark Nanneman Profile Picture
    991 Super User 2025 Season 2 on at
    Overwrite SharePoint list instead of appending
    This can be done if the data in your CSV has a unique key.  For example, a 'Serial Number' column that has no duplicates, or an "Email" column with no duplicates, or in the best case an "Id" column with unique GUIDs or other ID values.

    In general the process could be like:

    1. Parse your CSV or Excel import.
    2. Iterate through each row with a "Apply to Each" loop.
    3. Filter your destination database (in your case a SharePoint List) to check for any existing rows that have the same unique key value as your current CSV row.
    4.  Add a compose action that counts the length of the returned array from your fitlered "Get Items" (use the Length() function on the value array output of the get items action.
    5.  Add a condition to create a new item in the list in the case that there are no existing rows with the unique key.
    6.  Add an update action to update either the existing Item or the newly created Item (you could do this by setting a variable to the Item ID of whatever the filter finds as well as setting the same variable to the ItemID of the created item in the create a new item condition branch).

    The flow will go through your CSV rows, Pull a list looking for "ID eq '@{Item()?[CSV_Row_Unique_Id]}'", if it finds one it sets varItemIdToUpdate to the existing SharePoint ItemId, if zero

    If this helped you, please click "Does this answer your question" and give it a like to help others in the community (+ close the ticket)!

    Power Platform Developer | LinkedIn: Mark Nanneman | Blog: Power Stuff  | YouTube: Mark's Power Stuff  |

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Tomac Profile Picture

Tomac 497 Moderator

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 477 Super User 2025 Season 2

#3
chiaraalina Profile Picture

chiaraalina 242

Last 30 days Overall leaderboard