Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Unanswered

Get date from filename, reverse it, and add it to an item in Sharepoint list

(0) ShareShare
ReportReport
Posted on by 14

When a file (Excel) is added to my document library on Sharepoint, an automatic flow takes all the data and adds it to a Sharepoint list. So far, everything is working fine.

 

The Excel file's name I generate contains a date that I want to add to each item in my Sharepoint list. A column is provided for this purpose.

However, I am facing two problems:


1. The file name has other characters (they will always be the same characters, only the date changes in the file name). How to remove the other characters?
File name: xxx_20220407_xxx.xlsx (20220407 = today's date)

 

2. The date is reversed, I should reverse the date to have 07042022.

 

In the end, this date should be included in the column provided for this purpose.

 

I have no idea where to start to get this done.

 

Thank you in advance for your help,

 

  • chriscooper103 Profile Picture
    25 on at
    Re: Get date from filename, reverse it, and add it to an item in Sharepoint list

    Hi,  I have Simula requirement, is there any chance you could share the solution please?

  • fchopo Profile Picture
    7,968 Super User 2025 Season 1 on at
    Re: Get date from filename, reverse it, and add it to an item in Sharepoint list

    Hi @KD86 

    Could you post the solution so it could help others?

    Thanks!

  • KD86 Profile Picture
    14 on at
    Re: Get date from filename, reverse it, and add it to an item in Sharepoint list

    Found the solution, close topic.

  • KD86 Profile Picture
    14 on at
    Re: Get date from filename, reverse it, and add it to an item in Sharepoint list

    I managed to get 20220407 out of the file name.

     

    But I've got an error on compose 2 :

    Action 'Compose_2' failed
    Unable to process template language expressions in action 'Compose_2' inputs at line '0' and column '0': 'In function 'formatDateTime', the value provided for date time string '20220407' was not valid. The datetime string must match ISO 8601 format.'.
     
  • KD86 Profile Picture
    14 on at
    Re: Get date from filename, reverse it, and add it to an item in Sharepoint list

    Delete

  • fchopo Profile Picture
    7,968 Super User 2025 Season 1 on at
    Re: Get date from filename, reverse it, and add it to an item in Sharepoint list

    Hi @KD86 

    You could follow next steps:

    1) Get date from file name using compose action:

    split('xxx_20220407_xxx.xlsx','_')[1]

    2) Reverse date:

    formatDateTime(outputs('compose'),'ddMMyyyy')

    where outputs('compose') is the output of step 1.

    Hope it helps!

    Ferran

  • KD86 Profile Picture
    14 on at
    Re: Get date from filename, reverse it, and add it to an item in Sharepoint list

    Delete

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1