“I’m trying to update multiple rows in an Excel file with Power Automate, but it keeps overwriting the data on the first row!”
Using Power Automate to update rows in an Excel file has a small downside – there’s no unique id to identify the rows. Unlike in SharePoint, where you select the row id, in Excel you use the Key Column and Key Value combination. A column the flow should search in, and the value it should search for. The first row containing the value is the one that the flow will update.
Which can be a problem if the table contains duplicate values. The flow will never move to the 2nd or 3rd row, it’ll keep updating the first one from the top.
Unless you use a small workaround.
Add a new column to the Excel file
To update a specific row you’ll always need the column – value combination. The only way to move to the next row would be to modify the value in the currently processed row, and let the flow find the next one. But it’s not always possible to change the value as you need the information. For this reason you’ll need another column with the same information, whose modification won’t matter.
Once you have this column you can use it in the ‘Update a row’ action. Find the row with the value, update the other columns, and change the value. Just keep in mind that the value must be unique, e.g. a date and time.
Once the value is updated, the flow will automatically select the next row for the next update.
When building a flow, you should always consider not only the flow itself, but also the data it works with. If Power Automate doesn’t allow you to update multiple Excel rows with the same value, you can just add another column as a workaround. It’ll find the row with the value duplicate, update it, and change the value. That way it’ll never find the same row, always updating the next one.
But you can make your life much easier if you add a unique id to each row.