web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Increment a variable e...
Power Automate
Unanswered

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!

Categories:
I have the same question (0)
  • ScottShearer Profile Picture
    25,270 Most Valuable Professional on at

    @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.

     

     

  • Community Power Platform Member Profile Picture
    on at

    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.

  • Verified answer
    ScottShearer Profile Picture
    25,270 Most Valuable Professional on at

    @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

    Perfect Thanks 🙂

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard