cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
juphi17
Level: Powered On

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
Super User
Super User

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
Super User
Super User

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

juphi17
Level: Powered On

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
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (6,957)