Skip to main content

Notifications

Community site session details

Community site session details

Session Id : /TQdl5GFrXmkHNNLnkwjdI
Power Automate - General Discussion
Unanswered

Auto increment a row in MS Excel using Power Automate

Like (0) ShareShare
ReportReport
Posted on 12 Jan 2023 20:33:22 by 8

Hi all,

 

I have a question regarding how to automatically increment a row with a number (1 greater than the preceding row) in MS Excel whenever a new row is added in the ID column (see below). I am using an MS Form as a trigger to add a new row and the concept seems really straightforward, however I have not been able to get it to work. In my latest attempt as shown below, I am able to increment but it will add the same row anywhere from 12 times - 148 times. I am not sure what is missing and am open to any ideas on how to achieve the incrementation.

 

This is the current flow that I have. I am posting the overview and then the in-depth dynamic content (three parts) used to build the flow.

Flow Overview

RADSHAR_0-1673554858137.png    

Part 1

RADSHAR_1-1673554889653.png

 

Part 2

RADSHAR_2-1673554983904.png

 

Part 3

RADSHAR_3-1673555001739.png

 

Excel Result

RADSHAR_4-1673555050446.png

Note that this 15 times is added in one run, from one response to the flow. Sometimes it can be more than 15 using the same flow (and nothing has changed).

 

I have checked and I do not have concurrency enabled, and I have tried building flows using the following functions:

- integer function

- add function

- call the last row using last and then adding + 1

- composed various outputs

-Append Array Variable

- Converted to a string and then add string

 

And I have faced issues regarding the fact that the integer function requires an integer and although I have an integer, not sure what is going wrong. When I did compose the output of add, I got it to add a row, but it consistently said 1 for each entry and would not increment. I am sure this is pretty simple but not sure why I have not got it to work. I am open to any flow ideas to achieve my function.

 

Thank you so much for the help!

Categories:
  • RADSHAR Profile Picture
    8 on 12 Jan 2023 at 23:49:29
    Re: Auto increment a row in MS Excel using Power Automate

    Thank you for your prompt response! Sorry I meant auto increment ID. Based on your response I tried the following flow but have been met with similar fate. Attached below is the flow based on your response.

    RADSHAR_0-1673566986894.png

    However, the rows added are random and the ID does not increment. For example the first ID increment was 2, and another row the increment was also 2. The third test resulted in a ID of 3, however the following 4th test also had an ID value of 3. Wanted to share this flow incase I was doing something wrong on my end.

     

  • Hardesh15 Profile Picture
    7,087 Super User 2024 Season 1 on 12 Jan 2023 at 22:45:44
    Re: Auto increment a row in MS Excel using Power Automate

    @RADSHAR  You do not need to auto increment row. it will automatically append in last row. Do you want to increment ID?

    Use length() to get number of items from list row present in a table action then set variable value as length() then increment variable by 1. Now your variable will have one value greater than previous one. Then use add a row into a table action .

    No need to use apply to each.

    Please 'Thumbs Up' the posts that helped you and 'Accept as Solution' if my post answered your question.

    @Hardesh /Gopenly.in

     

  • RADSHAR Profile Picture
    8 on 12 Jan 2023 at 22:27:52
    Re: Auto increment a row in MS Excel using Power Automate

    Here is an example of another flow that I have tried. This one works 50% of the time, and the other 50% of the time it will either not increment and just upload with "2" or it will say the input is not an integer for the Compose 2 function. Very random. For the time it "works" the updated row will increment but every 4th try, it will not increment and take the number above the row. E.g. if it was 114 below, it will come up as 114 in the next.

    RADSHAR_0-1673562462802.png

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,668 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,004 Most Valuable Professional

Leaderboard
Loading started