Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Using Flows
Answered

Increment a variable each time an automated flow is run

(0) ShareShare
ReportReport
Posted on by

I'm making a flow that saves each new email attachment that comes into a shared mailbox by a new name in sharepoint that includes a number that increases by 1 each time a new file is created. I'm looking for a suggestion on how to do this. I was originally going to get a number from a cell in an excel table, add it to the file name, and then increment it up one and update the excel cell with the new number but I can't figure out how to do that. Thanks!

  • Community Power Platform Member Profile Picture
    on at
    Re: Increment a variable each time an automated flow is run

    Perfect Thanks 🙂

  • Verified answer
    ScottShearer Profile Picture
    25,208 Most Valuable Professional on at
    Re: Increment a variable each time an automated flow is run

    @Anonymous 

    See my example below.  You can refer to the variable when renaming the file.  I could have made this a bit more elegant with the use of expressions, but I tried to keep it as simple as possible.

    OneUp1.jpgOneUp2.jpgOneUp3.jpg

  • Community Power Platform Member Profile Picture
    on at
    Re: Increment a variable each time an automated flow is run

    Thanks @ScottShearer 

     

    Could you provide an example? I am having trouble capturing the number in the list as a dynamic value so I can initialize a variable.

  • ScottShearer Profile Picture
    25,208 Most Valuable Professional on at
    Re: Increment a variable each time an automated flow is run

    @Anonymous 

    There are a few ways to go about this.  Since you're already using SharePoint, why not just create a custom SharePoint list.  Add a number column to the list - call it something like NextNumber.  The list will only have one row of data.  Use a SharePoint Get Items action to retrieve that row and the number.  Then, update the SharePoint list incrementing the number by 1.  Using a SharePoint list will allow you to avoid issues that sometimes take place when updating Excel files.

    As I said, there are a number of ways to go about this...

    If you need an example, please let me know.

     

     

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

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,605 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,946 Most Valuable Professional

Leaderboard

Featured topics

Restore a deleted flow