Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Using Flows
Answered

Inserting date/time into Excel

(0) ShareShare
ReportReport
Posted on by 24

I have a flow that parses information from the body of an email and adds it in a new row in excel. The problem that I am having is that the date/time is going in as a string.

 

The date/time comes from the first line of the email: "An order was placed for the following product(s) on 17/03/2022 20:28:14." 

This is what I'm doing:

1. Pull out the date and time

lburmz_0-1647964408882.png

2. Initialize a date/time variable as string

lburmz_0-1647958701679.png

 

 

 

 

 

 

3. Split into date and time

lburmz_1-1647958753886.png

 

 

 

 

4. Split the date into dd, mm and yyyy components

lburmz_2-1647958789412.png

 

 

 

 

5. Create a string combining the date and time components into ISO format (I have tried with and without formatDateTime() - makes no difference)

lburmz_3-1647959143882.png

6. Insert into excel

lburmz_4-1647959232135.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

This all works well, except that the date and time go in to excel (on sharepoint) as a string (align to the left):

lburmz_5-1647960110196.png

 

If I then double click on the relevant cell it turns in to a date.

 

If anyone can suggest how to ensure that this goes in as a date, or can suggest a better way of constructing the date and time, I appreciate any advice.

  • lburmz Profile Picture
    24 on at
    Re: Inserting date/time into Excel

    That is exactly what I need. Thank you very much.

  • v-jefferni Profile Picture
    on at
    Re: Inserting date/time into Excel

    Hi @lburmz ,

     

    Actually ISO format will be used for Text type Date&Time values from Excel. If you would like to get the whole date and time saved into Excel, you need to change one of the two parameters of the div function to float point number to make the result be float point number as well, otherwise you will get a integer that represents date only. So, change 864000000000 to 864000000000.0 will solve the issue.

     

    Hope this helps.

     

    Best regards,

    Community Support Team _ Jeffer Ni
    If this post helps, then please consider Accept it as the solution to help the other members find it.

  • lburmz Profile Picture
    24 on at
    Re: Inserting date/time into Excel

    Hi again. So that does mostly work, but it doesn't include the time, only the date. For example, what I need is '26/03/2022 16:47:51' and what I'm getting is '26/03/2022 00:00:00'

  • lburmz Profile Picture
    24 on at
    Re: Inserting date/time into Excel

    Thank you, I'll try that.

     

    Surely though the whole point behind Microsoft adding the ISO format capability to Excel is so that you don't have it convert it to a serial number?

  • Verified answer
    v-jefferni Profile Picture
    on at
    Re: Inserting date/time into Excel

    Hi @lburmz ,

     

    You will need serial numbers to save to Excel datetime column:

    vjefferni_0-1648201898592.png

    add(div(sub(ticks('03/17/2022 20:28:14'),ticks('1900-01-01T00:00:00Z')),864000000000),2)

    vjefferni_1-1648201967059.png

     

    https://manueltgomes.com/microsoft/convert-date-to-excel-number/

    https://ryanmaclean365.com/2020/07/28/converting-excel-date-time-serial-values-with-power-automate/

     

    Hope this helps.

     

    Best regards,

    Community Support Team _ Jeffer Ni
    If this post helps, then please consider Accept it as the solution to help the other members find it.

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,660 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,999 Most Valuable Professional

Leaderboard

Featured topics

Restore a deleted flow