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 / Date change when writi...
Power Automate
Unanswered

Date change when writing to excel xlsx

(0) ShareShare
ReportReport
Posted on by 44

Hi Community

 

Date change when writing to excel file.?

 

kriho_0-1664452228915.png

Outcome

 

kriho_1-1664452278158.png

 

2 dates have changed.?

 

Greetings

Kristian Holm

Developer

I have the same question (0)
  • momlo Profile Picture
    1,527 Super User 2024 Season 1 on at

    This is OS/Excel regional settings conflict issue not PAD issue.

    It is actually row 1 and 2 recognized as date.

    Third row is not recognized by Excel as date but as txt

    It seems your OS uses MM-dd-yyyy and you are passing dd-MM-yyyy.

     

    Try reformatting your variables to match OS regional settings, otherwise you will need to format the Excel cells before you paste the values.

  • ThomasFonn Profile Picture
    273 on at

    Hello @kriho 

     

    I'll just post a dirty workaround.

    Instead of using the "Write to Excel worksheet"-action, you could instead use the "Activate Cell in Excel Worksheet"-action and then use the "Send keys"-action (don't forget to add a {Return} at the end).
    If you get the same problem as before, you may have to look at the cell format for those cells in particular, as momlo suggested.

  • kriho Profile Picture
    44 on at

    Hi momlo

    My OS uses dd-MM-yyyy

     

    kriho_0-1664519174722.png

     

  • ViliBit Profile Picture
    127 on at

    You can use "Convert datetime to text" action and save dates as text on excel, avoiding auto format by excel.FOrmat as text.png

     

  • momlo Profile Picture
    1,527 Super User 2024 Season 1 on at

    Looks ok, I woudl only check in Excel if there is no setting overwriting default date.

    Did you try reformatting your variables to see if this solves the issue?

     

     

  • kriho Profile Picture
    44 on at

    Hi Momlo

     

    kriho_0-1664522972116.pngkriho_1-1664523006651.png

    kriho_2-1664523171027.png

    No difference in saving from date to text and then writing to excel

     

  • momlo Profile Picture
    1,527 Super User 2024 Season 1 on at

    I took more time and tested on my machine:

     

    1. Regional settings matach yours: short date = dd.MM.yyyy

    momlo_0-1664526638598.png

     

    2. I assume based on your code, this is format you want to get in excel:

    momlo_1-1664526672591.png

     

     

    3. I recreated your code

     

    momlo_2-1664526690419.png

     

    4. And I got... the same result as you. But! We thought it is row 3 put incorrectly and rows 1 and 2 ok, but this is exactly opposite if we use formulas to grab parts of a date:

     

    momlo_3-1664526712049.png

     

    5. I did copy/paste the values from notepad and voila! Values are correct in Excel. So definitely issue between PAD and Excel

     

    momlo_4-1664526861085.png

     

    6. I have then reformatted variables in pad from your 'dd-MM-yyyy' to 'MM-dd-yyyy' and this time - correct results in Excel.

     

    momlo_5-1664526932011.png

     

    momlo_6-1664526942877.png

     

    So to wrap up:

    When pasting value from PAD (yours and mine) - values are assumed by Excel as 'MM-dd-yyyy' as suggested initially.

    I try to avoid using pasting dates into Excel - afaik it is nightmare with those formats conflicts, so for example I often put time stamps as text.

  • kriho Profile Picture
    44 on at

    Hi momlo thanks for the test

    I am a little concerned about PAD assume that date is MM-dd-yyyy. Because what if the date already is MM-dd-yyyy will it not change it to dd-MM-yyyy.? 

    When writing the date it should be that what you see is what you get and no change in format.

     

    An example when you write a datatable using write to Excel worksheet and the dateformat is dd-MM-yyyy

    is very convenient first to change the dateformat to MM-dd-yyyy in the datatable before using the action write to Excel worksheet.?

    kriho_0-1664694647358.png

    Datatable

    kriho_1-1664694709304.png

     

    Writing to excel using datatable

    kriho_2-1664694747502.png

     

    date has changed.

    The OS is dd-MM-yyyy

    To me that should be an error. It is not logic to change the date format everytime you write to excel.?

     

    Greetings

    Kristian Holm 

    RPA Developer

     

     

  • MarcThomas Profile Picture
    8 on at

    Hello @kriho 

     

    I am also a danish RPA developer who has just run into the same issue as you had.

     

    Did you ever find a solution to this?

  • kriho Profile Picture
    44 on at

    Hi Marc try to set timezone to system when you getd

    kriho_0-1705052063590.png

    power automate desktop is set as default to American date

    The American date is month/day/year

    you can also Change date to text and then put a empty space in front of the date

    greetings kristian

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
Vish WR Profile Picture

Vish WR 873

#2
Valantis Profile Picture

Valantis 820

#3
Haque Profile Picture

Haque 505

Last 30 days Overall leaderboard