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 / PowerAutomate to copy ...
Power Automate
Answered

PowerAutomate to copy file and capture and Append Everyweeks Monday's date to new File name

(1) ShareShare
ReportReport
Posted on by 56
Hi team,
 
I have scenario in SharePoint Document library to copy excel file with file name ("TestAttachment 2.03.2025.xlsx") to same folder location and append every week Monday's date to the file name ("TestAttachment 2.10.2025.xlsx") when we manually trigger the flow to perform other sequence operations.. 
 
Can someone help me how to copy file to same location and capture file name with everyweek Monday's date and append to file name will be great help to apply in multiple flows.
 
Example file Name when we trigger the flow :
 
copy file "TestAttachment 1.27.2025.xlsx" to "TestAttachment 2.03.2025.xlsx"
copy file "TestAttachment 2.03.2025.xlsx" to "TestAttachment 2.10.2025.xlsx"
copy file "TestAttachment 2.10.2025.xlsx" to "TestAttachment 2.17.2025.xlsx"
                                 
 
 
Categories:
I have the same question (0)
  • Verified answer
    Ravi-Prajapati Profile Picture
    416 Super User 2025 Season 2 on at

    You can achieve this in Power Automate by following these steps:


    Solution Overview

    1. Get the existing file from SharePoint.
    2. Determine the next Monday's date based on the filename.
    3. Copy the file with the new filename.
    4. Save it in the same folder with the updated name.

    Step-by-Step Implementation in Power Automate

    1. Trigger

    • Use a Manually Triggered Flow or any other trigger as per your needs.

    2. Get the File Details

    • Use "Get file properties" (SharePoint) action to retrieve the file's metadata.
    • Use "Get file content" (SharePoint) to retrieve the actual file.

    3. Extract Date from File Name

    • Use the "Compose" action with the following expression to extract the date from the filename:
      last(split(triggerOutputs()?['body/{Name}'], ' '))
      • This extracts the date portion "2.03.2025.xlsx" from "TestAttachment 2.03.2025.xlsx".

    4. Convert the Date and Calculate Next Monday

    • Add a "Compose" action with this expression:
      formatDateTime(addDays('2025-02-03', 7), 'M.dd.yyyy')
      • This adds 7 days to the extracted date to get the next Monday.

    5. Generate New File Name

    • Use a "Compose" action to construct the new file name:
      concat('TestAttachment ', formatDateTime(addDays('2025-02-03', 7), 'M.dd.yyyy'), '.xlsx')
      • Example Output: "TestAttachment 2.10.2025.xlsx"

    6. Copy and Rename the File

    • Use "Create file" (SharePoint) action to copy the file to the same folder with the new name.
      • Folder Path: Select the same folder where the original file is located.
      • File Name: Use the output from the previous step.
      • File Content: Use the output from "Get file content".

    Final Flow Logic

    1. Trigger: Manually trigger the flow
    2. Action: Get file properties (SharePoint)
    3. Action: Get file content (SharePoint)
    4. Action: Extract existing date from file name
    5. Action: Calculate next Monday's date
    6. Action: Generate new file name
    7. Action: Copy and save the file with a new name

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

#2
Tomac Profile Picture

Tomac 296 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard