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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Add number to file name.
Power Automate
Answered

Add number to file name.

(0) ShareShare
ReportReport
Posted on by 126

Hello.

 

I created a simple automation for PowerAutomate to copy a file from a local drive to OneDrive everytime it is modified.

I would also want to don't replace it but instead I would want to add one more file with a differente name (Book1.xlsx, Book2.xlsx, Book3.xlsx, etc).

 

Can you please help me to do that?

 

Thank you. 

Categories:
I have the same question (0)
  • Paul_Gibson Profile Picture
    25 on at

    Hi there,

     

    If you are doing this to a specific file, instead of numbering the files, it may be easier to append with the date and time and use the following structure:

     

    Paul_Gibson_0-1646745763663.png

     

    In which the formatDateTime is:

     

    formatDateTime(body('Current_time'),'dd_mm_yyyy_hh_mm')
     
     
  • RL-26071304-0 Profile Picture
    126 on at

    Thank you for your answer.

     

    The file is correctly created but it still doesn't create multiples files. Instead, it replaces the existing file.

  • Verified answer
    Paul_Gibson Profile Picture
    25 on at

    If you are testing it and run the code a few times in the same minute, this may happen since the date and time is only being formatted to the nearest minute. You can adjust this by using the following to add the seconds also:

     

    formatDateTime(body('Current_time'),'dd_mm_yyyy_hh_mm_ss')

     

    This way, unless the flow is ran twice with in the same second (which is not likely), you should have new files created on your One Drive each time with a different time stamp on them.

  • nilotbh Profile Picture
    2 on at

    Hi,

     

    Follow the below steps to append a number to your filename-

     

    a. Create a Variable in POwerAutomate. Let's say the VarName is "NewVar" (Which is the default name when you add a variable). Assign a value of 1.

    2. Inside the loop, append this variable to your file name like this -

    %SpecialFolderPath%\<YourFolderName>\<FileName>%NewVar%.<FileExtension>

    e.g.

    %SpecialFolderPath%\myFolder\MyFile%NewVar%.xlsx

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 274 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 175

#3
Haque Profile Picture

Haque 166

Last 30 days Overall leaderboard