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 / Get date from filename...
Power Automate
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,

 

Categories:
I have the same question (0)
  • KD86 Profile Picture
    14 on at

    Delete

  • fchopo Profile Picture
    8,003 Moderator on at

    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

    Delete

  • KD86 Profile Picture
    14 on at

    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

    Found the solution, close topic.

  • fchopo Profile Picture
    8,003 Moderator on at

    Hi @KD86 

    Could you post the solution so it could help others?

    Thanks!

  • chriscooper103 Profile Picture
    25 on at

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

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 594

#2
Valantis Profile Picture

Valantis 328

#3
David_MA Profile Picture

David_MA 281 Super User 2026 Season 1

Last 30 days Overall leaderboard