Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Unanswered

update csv files on SharePoint

(1) ShareShare
ReportReport
Posted on by

Hello! 

thank you @rzaneti for helping with my question on Uploading multiple CSV files to SharePoint

I have a follow up question: I want to update the files that were uploaded because now the status has changed.

The condition is

1) if the file uploaded is new then upload the new data to sharepoint list

2) if the file uploaded is an old data but with new updates then update the new information to sharepoint list

Here is the flow:

shirokun_0-1719977432351.png

shirokun_1-1719977527584.pngshirokun_2-1719977555681.png

 

 

shirokun_3-1719977579573.png

shirokun_4-1719977651691.png

 

this is the error message I got 

shirokun_5-1719977823594.png

 

 

Here is the new data 

shirokun_6-1719978118273.png

How can I fix my flow? 

Thank you for your help!!! 

 

  • shirokun Profile Picture
    on at
    Re: update csv files on SharePoint

    @rzaneti Thank you so much!! changed update item express to 

    shirokun_0-1720812854726.png

     and everything worked!! 

  • shirokun Profile Picture
    on at
    Re: update csv files on SharePoint

    I SEE!  "As Update Item is inside an internal loop, we won't be able to use the item() in your expression, as it will capture the items iterated in the For each loop, rather than in the Appy to each."👍am really learning as I go. 

     

    Here is the update: 

    ID in update item still remains:  int(trim(split(item(), ',')[0]))

    i changed expression in update item like the following:

    Machine ID: int(trim(split(items('Apply_to_each'), ',')[0]))

    Status value: 

    int(trim(split(items('Apply_to_each'), ',')[6]))
    Comments: 
    int(trim(split(items('Apply_to_each'), ',')[7]))
     
    result:
    shirokun_0-1720741636084.png

     

    shirokun_1-1720741662534.pngshirokun_2-1720741679649.pngshirokun_3-1720741697870.pngshirokun_4-1720741714702.png

    Thank you kindly!

  • rzaneti Profile Picture
    4,096 Super User 2025 Season 1 on at
    Re: update csv files on SharePoint

    Hi @shirokun ,

     

    I've made a mistake in the instructions above. As Update Item is inside an internal loop, we won't be able to use the item() in your expression, as it will capture the items iterated in the For each loop, rather than in the Appy to each

     

    To solve it, you can replace item() for items('Apply_to_each') in the expressions that I sent. The expression to capture the Machine ID, for example, will be int(trim(split(items('Apply_to_each'), ',')[0]))

  • shirokun Profile Picture
    on at
    Re: update csv files on SharePoint

    Thank you again! changed ID to int(trim(split(item(), ',')[0])) in update item

    shirokun_2-1720733304016.png

     

    this message pops up: 

    shirokun_1-1720733124368.png

    in fact, i tried a lot of different things and this message always comes up. 

    shirokun_0-1720733094138.png

     

  • rzaneti Profile Picture
    4,096 Super User 2025 Season 1 on at
    Re: update csv files on SharePoint

    Thank you for sharing it!

     

    For the Id in the Update item, try to use int(trim(split(item(), ',')[0])). It will returns the 55555. For all other properties (except for status), you can use the expressions shared some messages ago 🙂

     

    Please, test it and let me know if it works 🙂

  • shirokun Profile Picture
    on at
    Re: update csv files on SharePoint

    here is the raw outputs. a single line in a CSV format too?

    shirokun_0-1720644942838.png

    shirokun_1-1720644969321.png

    shirokun_2-1720645080137.png

     

    Thank you!

     

  • rzaneti Profile Picture
    4,096 Super User 2025 Season 1 on at
    Re: update csv files on SharePoint

    Hi @shirokun ,

     

    Something is still not working properly in the loop logic: once we solve it, you probably will be able to access the Machine ID dynamically to use in Get items. 

     

    Let's see what exactly are being returned for each loop iteration. Inside the apply to each loop, add a "Compose" action, and set the expression item() as value, just like in the example below:

    rzaneti_0-1720642394317.png

     

    After that, please share the raw outputs from Compose. 

     

  • shirokun Profile Picture
    on at
    Re: update csv files on SharePoint

    Hello @rzaneti 

    I still not quite sure what to set for the get items so I set the filter query to MachineID eq '5555555' (I tried other ones and they dont work) to run this flow. The result showing with Machine Id - trim(split(item(), ',')[0]) and .... is 

    shirokun_0-1720632766069.png

    shirokun_1-1720632988801.png

     

    updating item is always the hardest =*( 

    Thank you...

  • rzaneti Profile Picture
    4,096 Super User 2025 Season 1 on at
    Re: update csv files on SharePoint

    Hi @shirokun ,

     

    Thank you for the image! Your Filter array is returning a single line in a CSV format, and that's why we cannot access the item properties like "Comments", for example. To solve it, we can use some text expressions, where we will isolate each of the columns from this CSV representation by breaking it by comma. 

     

    You can use the following expressions to access each data in the Update item:

    • For Machine Id - trim(split(item(), ',')[0])
    • For Machine Type - trim(split(item(), ',')[1])
    • For Manufacture date - trim(split(item(), ',')[2])
    • For Site - trim(split(item(), ',')[3])

    ....and so on for each other columns in sequence, always increasing by 1 the number between brackets. For the "Comments" column, which is the last one in your file, you will use the expression trim(split(item(), ',')[7]).

     

    Let me know if it works!!

  • shirokun Profile Picture
    on at
    Re: update csv files on SharePoint

    Hello @rzaneti  

    😢the test didnt go well. Here is the raw outputs from Filter array 

    shirokun_0-1720547226173.png

    shirokun_1-1720547242806.png

    And here is the outputs from Get items: 

    { "status": 400, "message": "The expression \"item()['Comments']\" is not valid. Creating query failed.\r\nclientRequestId: e0cdf628-082e-46d7-a322-b437eb876ba1\r\nserviceRequestId: cfac3aa1-b011-5000-e0f0-7b89d0fb1d57" }

     

    Thank you x 10000 

     

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

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 566 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 516 Super User 2025 Season 1

#3
stampcoin Profile Picture

stampcoin 492