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

Community site session details

Session Id : +1StqvE+R4aQMToqGVV4VG
Power Automate - General Discussion
Answered

Date conversion from CSV to SharePoint

Like (0) ShareShare
ReportReport
Posted on 16 Feb 2024 18:08:58 by 10

Hello everyone! I'm working on a flow that aims to migrate records to a sharepoint list.

 

The flow follows the following steps:
1. Receive the CSV file
2. Rebuild the files with a 'Select'
3. Iterate over each record with an 'Apply to each'
4. Apply a series of filters.
5. Save the current record in a variable of type array ('registroArrayFecha').
6. Format the date1
7. Format the date2
8. Evaluate which date is larger with a condition.
9. Create item in sharepoint list and export the record.

 

The structure of the record saved in the variable ('registroArrayFecha') would be something like this:

 

 

 

[
 {
 "Resource Name": "User, Name",
 "Work Order": "17992541",
 "Work Country": "Spain",
 "Start Date": "21-2-23",
 "Created Date": "9-2-23",
 }
]

 

 

 

 

The first problem occurs in point 6, when I try to extract the value of 'Start Date' from the variable 'registroArrayFecha' and give it a format to be able to later evaluate this date in a condition.

 

The expression I use to give this format is the following: (This expression is inside a 'Compose')

 

 

 

formatDateTime(concat('20',
split(variables('registroArrayFecha')[0]['Start Date'], '-')[2], '-',
split(variables('registroArrayFecha')[0]['Start Date'], '-')[1], '-',
split(variables('registroArrayFecha')[0]['Start Date'], '-')[0]),
'dd-MM-yyyy')

 

 

 

The error occurs in certain records. On the one hand we have records in which the date is maintained, for example:

Correct conversionCorrect conversion

 

And on the other hand we have records in which we obtain a completely different Compose output, example:
Incorrect conversionIncorrect conversion

 

Entry dates always come in 'dd-MM-yyyy' format.

To summarize, I can't get all the dates to import in the same format so I can evaluate them.

  • usernull_1234 Profile Picture
    10 on 17 Feb 2024 at 17:42:07
    Re: Date conversion from CSV to SharePoint

    Hi @SamLed,

     

    Thank you very much for the response, very useful!

  • Verified answer
    SamLed Profile Picture
    2,332 Moderator on 16 Feb 2024 at 21:30:01
    Re: Date conversion from CSV to SharePoint

    Hi @usernull_1234,

     

    You should use parseDateTime() function:

     

    SamLed_0-1708118401676.png

     

    Results without specifying any format (ISO 8601 compliant by default) :

    SamLed_1-1708118472317.png

     

    [Edit] found a nice article explaining this function and providing a list for locales: Power Automate ParseDateTime Function Explained (zeitgeistcode.com)  

    ______________________________________________________________

    If I have answered your question, please Accept the post as solution.
    If you like my response, please Thumbs Up.

     

     

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

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!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 2

Loading complete