I seem to be having this issue for the past few days. I was asked by my mentor to create a workflow that could be used for retrieving currency exchange values from a website and write them down in Excel. I used a Loop, but I was advised to use a For Each action instead.
However, I seem to be encountering this error, wherein the CurrentItem in For Each is declared invalid whenever I try to execute the workflow.
I keep getting this in the error: Correlation Id: 28932dba-2fa8-4602-90d1-c2f748017aa5
Following screenshots have been provided for reference.
Any tips and advice will be highly appreciated.
I would assume this might be because your Read from Excel worksheet probably includes the one last row at the end, too. It might for some reason "think" it's not empty - maybe it had data previously and has some formatting stored there, that has not been cleared properly. Try deleting the row from Excel completely and then run it to see if this helps. Otherwise, add an If statement inside your loop to check if %CurrentITem['Value']% is empty. If it is, use Next loop to skip further actions for this row, or Exit loop to stop looping.
-------------------------------------------------------------------------
If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.
I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.
Thanks for this! This works, for the most part. I just encountered a tiny issue - when I tried to implement the new variable for the existing rows, it repeats for the last row and then, adds an additional value to the Excel worksheet. Can you help me figure out why it is doing so and how can I fix it?
Here's the workflow for reference -
I tried using %nbrrowindex - 1%, but this causes it to overwrite the column header with the extracted numeric value instead. How can I avoid that?
%FirstFreeRow% is a thing that makes sense when you want to append new rows to a table. But you want to write data to existing rows, so that won't work.
Instead, you will need to implement a loop index. Use Set variable before your loop and set an index to 2 (that's the row where your data starts). Then use that variable as the row index in Write to Excel worksheet. And then use Increase variable at the end of the loop to increase it by 1.
-------------------------------------------------------------------------
If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.
I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.
Yeah, but I actually want to write the numResultList in a specified column range - however, what I used for it isn't working anymore.
Initially I was using CurrentItem but that was invalid, as Row required a numerical value. So I tried using FirstFreeRow - but that doesn't seem to be working either.
This is the Excel worksheet I am using, and I wish to write the result extracted in the D column. What can I do in the Write to Excel action to fix this issue?
the action write to excel has nothing to do with CurrentItem. It writes to excel values got of element on web page.
see bellow yellow:
you need to specify more detail your problem?
Hi, sorry to bother you again - but the Write to Excel function is not working and using CurrentItem doesn't working as this action requires a number. How can I fix it?
That actually worked! Thank you so much for the help! ❤️
you need to use: %currentItem[colum name or number]% and then you get value automatically
Michael E. Gernaey
497
Super User 2025 Season 2
David_MA
436
Super User 2025 Season 2
Riyaz_riz11
244
Super User 2025 Season 2