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

Getting value from previous row in Excel

Hi there,

I have successfully created a Flow that adds a row to my Excel spreadsheet everytime an item is added to a SharePoint list.

However, for one of the columns, I can't figure out how to increment the number from the previous row.

 

E.g. if the spreadsheet looked like this:

ID         Project Name      Client Name

222       Project 1             John Smith

223       Test Project         Jane Smith

___         Another Test       Bob John

 

Not every item in the SharePoint list gets an ID, which is why I don't pull it from there.  I simply need a way to pull the last value from the spreadsheet from the ID column and increment it by 1.  I tried using the Get Row but had no luck with that.  Any ideas?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Re: Getting value from previous row in Excel

@juphi17 

Here is one way of meeting your requirement - see my screen shot below.  I limit the number or rows returned to 1 and sort in descending order.  Also I use an expression when I set my variable - the expression can be seen in the comments area.

Finally, I could have done everything after the Get rows action in one step using either a compose action or a variable. I chose not to as that would have been a bit difficult to explain. 

HighID.jpgHighID1.jpg

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

View solution in original post

2 REPLIES 2
Highlighted
Super User III
Super User III

Re: Getting value from previous row in Excel

@juphi17 

Here is one way of meeting your requirement - see my screen shot below.  I limit the number or rows returned to 1 and sort in descending order.  Also I use an expression when I set my variable - the expression can be seen in the comments area.

Finally, I could have done everything after the Get rows action in one step using either a compose action or a variable. I chose not to as that would have been a bit difficult to explain. 

HighID.jpgHighID1.jpg

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

View solution in original post

Highlighted
Microsoft
Microsoft

Re: Getting value from previous row in Excel

Thanks so much, Scott!  This worked like a charm 🙂

 

I wish there was a shorter way to do this instead of having to open the spreadsheet twice (one to get the ID and one to add the row).

But regardless, this works great and is easy to understand.

 

I appreciate your quick and detailed response. You rock! 🙂

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

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
Top Kudoed Authors
Users online (8,401)