cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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

Highlighted
juphi17
Level: Powered On

Re: Getting value from previous row in Excel

Thanks so much, Scott!  This worked like a charm Smiley Happy

 

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! Smiley Happy

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020.

thirdimage

Flow Community User Group Member Badge

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

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 Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 401 members 3,065 guests
Please welcome our newest community members: