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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Need help writing a flow
Power Automate
Answered

Need help writing a flow

(0) ShareShare
ReportReport
Posted on by 20

I need to grab values from each file in a folder and paste them into a single excel workbook. I've tried to write a flow for that gets the files in the folder and the runs a for each loop to copy and paste the values. The flow runs through all of the files but for some reason the variables aren't updating for each file, so the flow just writes the same value for each file. Please let me know if anyone can help with this. I am very new to power automate and I can't figure out how to make this work. 

 

Thanks in advance!

I have the same question (0)
  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    Paste the loop part of your flow so we can see where it is repeating itself.

     

    My guess is you are trying to reference %Files% instead of %CurrentItem% or something along those lines.

     

    Thanks,

     

    Mike

  • jwr2454 Profile Picture
    20 on at

    jwr2454_0-1644602428465.png

    Here is the flow 

  • UK_Mike Profile Picture
    on at

    Id remove that Launch Excel from the loop, stick it above.

    Not sure where your getting the first free row from ?

  • UK_Mike Profile Picture
    on at

    Also, I would have 2 separate Excel instances rather than attach, I find it a bit flaky.

  • jwr2454 Profile Picture
    20 on at

    So there actually is 2 Excel instances. 

    The first one at the top is "ExcelInstance" - this is the master file I need to past the data into. 

    Then the loop is set up with the following steps for each file in the folder:

    -Renames "CurrentItem" from %Files% to "Extract"

    -launches the file named "Extract" - this is "ExcelInstance2"

    -reads the data from "ExcelInstance2" - stores it as "NJClass12020"

    -gets the first available row from "ExcelInstance"'

    -writes the data stored in "NJClass12020" to the firstavailable row in "ExcelInstance"

    -Closes "ExcelInstance2"

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    MichaelAnnis_0-1644603951449.png

    My guess is your rename looks like this and it is not overwriting Extract.xlsx when you try to rename the second one.  If that's the case, you need to delete Extract.xlsx each time you are done with the file.

  • jwr2454 Profile Picture
    20 on at

    It actually is set to overwrite. When the loop is done running, there is only 1 file left in the folder named "Extract"

  • UK_Mike Profile Picture
    on at

    But with Launch Excel within the loop it keeps getting launched...

  • jwr2454 Profile Picture
    20 on at

    right, but since each file renamed as "Extract" before it launches, it should be opening a new file from the folder each time right?

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    It could be a number of issues...can I see the double down on the "Rename File" please.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 238 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 225

#3
Haque Profile Picture

Haque 181

Last 30 days Overall leaderboard