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 / Add number to file name.
Power Automate
Unanswered

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

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 523 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 406 Moderator

#3
abm abm Profile Picture

abm abm 245 Most Valuable Professional

Last 30 days Overall leaderboard