cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Update last line in Excel

Hi there,

 

How can I update the last row in an Excel table if several row are the same?

 

2019-05-23_17-54-00.jpg 

last(body('In_Tabelle_vorhandene_Zeilen_auflisten')?['value'])?['DATUM']
 
This will not be the last date on the last row but the first last date
2019-05-23_18-09-32.jpg
 
It would be great if someone can help me with this.
 
Best regard
 
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Dual Super User
Dual Super User

Re: Update last line in Excel

@RayRay 

So, you do not need the last row, but the last row with any value assigned to column "ENDE", right?

I also assume body('In_Tabelle_vorhandene_Zeilen_auflisten')?['value'] is the output of a 'List rows present in a table' action block, right?

If so, there is an excellent explanation on how to proceed in the following post

https://powerusers.microsoft.com/t5/Building-Flows/Flow-that-checks-for-empty-cells-within-an-excel-...

Please note the scenario descirbe in the post :

-is more complex than yours, in you case I guess it is enough to add the "Filter array" action block just after "List rows present in a table"

-assumes the opposite, i.e. the expression on the Filter Array described in the post [ equals(empty(item()?['date']), bool('True')) ] gets all rows with column 'date' empty, but you want to get all rows with column 'ENDE' not empty, so you will need something like [ not(equals(empty(item()?['ENDE']), bool('True'))) ]

Once you have all rows with column 'ENDE' not empty, you can apply last() expression to the output of 'Filter array' action block

 

Hope this helps

 



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



View solution in original post

2 REPLIES 2
Highlighted
Dual Super User
Dual Super User

Re: Update last line in Excel

@RayRay 

So, you do not need the last row, but the last row with any value assigned to column "ENDE", right?

I also assume body('In_Tabelle_vorhandene_Zeilen_auflisten')?['value'] is the output of a 'List rows present in a table' action block, right?

If so, there is an excellent explanation on how to proceed in the following post

https://powerusers.microsoft.com/t5/Building-Flows/Flow-that-checks-for-empty-cells-within-an-excel-...

Please note the scenario descirbe in the post :

-is more complex than yours, in you case I guess it is enough to add the "Filter array" action block just after "List rows present in a table"

-assumes the opposite, i.e. the expression on the Filter Array described in the post [ equals(empty(item()?['date']), bool('True')) ] gets all rows with column 'date' empty, but you want to get all rows with column 'ENDE' not empty, so you will need something like [ not(equals(empty(item()?['ENDE']), bool('True'))) ]

Once you have all rows with column 'ENDE' not empty, you can apply last() expression to the output of 'Filter array' action block

 

Hope this helps

 



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



View solution in original post

Highlighted
Solution Sage
Solution Sage

Re: Update last line in Excel

Hi @RayRay ,

I have made some tests on my side. It has the same issue as yours.

As the pic shown, the value of row 23, 24 25 are same.

So when you enter the last 'DATUM' value in the 'Key value' field to update the row 25, but actually, the flow is get the row 23 to update.

As you can see, you need use the 'Key column' and 'Key value' to get the specific row in the 'Update a row' action .

Capture.PNG

So if there are several same rows, it will update the top one.

So I am afraid you need create another column here to enter different value to distinguish each row.

Best Regards,

Community Support Team _ Zhongys

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

Join the new Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Users online (7,420)