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 Automate
Answered

Mixed date format

(0) ShareShare
ReportReport
Posted on by 2

Hi everyone,

I have a datatable with dates in format dd/MM/yyyy and when I write them into an excelsheet, dates up to day 12 change to MM/dd/yyyy and the rest remain as original format as you can see below (first picture is from the datatable and the second one is that PAD has written in the excelsheet once the file have been saved as *.xlsx

 

 

Picture1Picture1

18df0158-327b-497f-83af-bf37aa9f9020.png

Thanks in advance for your support.

  • VishnuReddy1997 Profile Picture
    2,666 Super User 2026 Season 1 on at

    Hi @Antoine_Ibanez ,

     

    Before writing it into the excel Please convert it into the text as required format as shown in below image.

    VishnuReddy1997_0-1715757804722.png

    Another method is after writing it to the excel.Please run VBscript using RunVbscript action.

    VBCode:

    Option Explicit
    
    Dim xlApp, xlBook, xlSheet
    Dim lastRow, i
    
    ' Create an instance of Excel
    Set xlApp = CreateObject("Excel.Application")
    
    ' Open the Excel file
    Set xlBook = xlApp.Workbooks.Open("C:\path\to\your\file.xlsx")
    
    ' Set the active sheet (change the sheet name if necessary)
    Set xlSheet = xlBook.Sheets("Sheet1")
    
    ' Find the last row with data in column C
    lastRow = xlSheet.Cells(xlSheet.Rows.Count, "C").End(-4162).Row
    
    ' Loop through each cell in column C and change the date format
    For i = 1 To lastRow
     If IsDate(xlSheet.Cells(i, "C").Value) Then
     xlSheet.Cells(i, "C").NumberFormat = "dd/MM/yyyy"
     End If
    Next
    
    ' Save and close the Excel file
    xlBook.Save
    xlBook.Close
    
    ' Quit Excel application
    xlApp.Quit
    
    ' Release the objects
    Set xlSheet = Nothing
    Set xlBook = Nothing
    Set xlApp = Nothing
    
    ' End of script

     

    (Note:- if you got your solution you can mark as solution and gives kudos)


    Thanks & Regards

    Vishnu Reddy

  • Verified answer
    NathanAlvares24 Profile Picture
    1,714 Moderator on at

    Hi @Antoine_Ibanez !

     

    Try this way. Extract for each row from that column. Say example you extract one row item from that Column3 from the datatable: %dt['Column#3']%

     

    Then use 'Convert datetime to text' action to convert that value to a certain format you want. So you need to use custom format. Say like below:

    '02/04/2024' to convert

     

    then format will be: 

    NathanAlvares24_0-1715758830390.png

     

    '/' in custom format is same as '-'

     

    So next step is to use 'Replace Text' action. See below:

    NathanAlvares24_1-1715759019006.png

     

    I hope this helps.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 249 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 198

#3
David_MA Profile Picture

David_MA 197 Super User 2026 Season 2

Last 30 days Overall leaderboard