Skip to main content

Notifications

Community site session details

Community site session details

Session Id : mGlIjaBF58Q3sybK4bVWlr
Power Automate - Building Flows
Answered

Excel dates turned into integers?

Like (3) ShareShare
ReportReport
Posted on 28 Jun 2018 15:59:31 by

Hello! I'm a fairly new flow user here and I have a flow which needs to extract dates from an excel spreadsheet and email them out. The kicker is that I cannot figure out why flow is importing the data from the spreadsheet as plain numbers instead of as dates even though the cells themselves are formatted as dates for example the date 06/18/12 is being read in as 41078, any advice? thanks in advance for the help!

  • cristianvalbar Profile Picture
    2 on 28 Aug 2023 at 06:13:42
    Re: Excel dates turned into integers?

    Maybe late for you, but the issue was the variable name 'Completion time' . I suggest to do not use spaces, try with some like 'Completion_time' or 'completionTime'.

  • Community Power Platform Member Profile Picture
    on 20 Jul 2021 at 18:09:07
    Re: Excel dates turned into integers?

    So after spending 1/2 the day yesterday learning about how to work with the Excel decimal format (and all the date and time calcs that come along), then teaching a class on it today, one of my colleagues pointed out the new-ish DateTimeFormat option in List All Rows in Table...

     

    At least they didn't point it out WHILE I was teaching the class... that might have been embarrassing... oh wait... yes they did 🙂

     

    All good. I'm REAL GOOD at decimal to date / time WDL calcs now. 

     

    https://powerusers.microsoft.com/t5/Power-Automate-Community-Blog/Excel-Date-changes-in-Power-Automate/ba-p/799959

     

    🌴to 🙂 !

  • hjaf Profile Picture
    486 on 20 Jul 2021 at 13:39:33
    Re: Excel dates turned into integers?

    There is a parameter for date time format. I believe this has been introduced after the initial post.
    Here you can see the documentation for listing rows, but this parameter is also available for updating and adding rows:
    https://docs.microsoft.com/en-us/connectors/excelonlinebusiness/#list-rows-present-in-a-table

    The documentation is a bit unclear and should really be improved. But from what i can gather, the values you can choose from in the connector is provides the following code in code view:

     

     

    "dateTimeFormat": "ISO 8601"

     

     

     

     

     

    "dateTimeFormat": "Serial Number"

     

     

    This suggest that only these two options are available, even though you can provide a custom value it is somewhat confusing. When attempting to use a custom ISO 8601 format the error informs about this:

     

     

    The API operation 'GetItems' requires the property 'dateTimeFormat' to be set to one of its defined enum values '["Serial Number","ISO 8601"]' but is set to 'YYYY-Www-D'.'.

     

     

    Turns out that the documentation is less helpful than the errors. The documentation says nothing about which ISO 8601 format one should use for input if that were the case. However it seems that the default ISO 8601 format "UTC" is used. 
    When ISO 8601 is selected the output is:

    1986-04-19T13:00:00.000Z

    otherwise it returns the serialized value:

     

     

    "31521.5416666667"

     

     

     

    The same thing is used for adding or updating rows, you can use the built-in time actions in power automate directly without having to deal with the formatting 🙂
    ISO 8601 excel inputISO 8601 excel input

  • Community Power Platform Member Profile Picture
    on 19 Jul 2021 at 17:45:19
    Re: Excel dates turned into integers?

    Finally figured this out...

    formatDateTime(
     addToTime(
     '00:00:00', 
     int(
     formatNumber(
     mul(
     86400, 
     float(
     concat(
     '.', 
     outputs('LAST_split_excel_date')
     )
     )
     ),
     'N0'
     )
     ),
     'Second'
     ),
     'HH:mm:ss tt'
    )

     Theres probably a better way to include the '.' than the hacky concat, but. This works. 

     

    Then proceed to: concat the calculated date and time into a string then format. 

     

    Wow. What a process to go from Excel's decimal format of date times back to human readable. 

  • Community Power Platform Member Profile Picture
    on 16 Jul 2021 at 22:23:21
    Re: Excel dates turned into integers?

    Grrrr.... this should be easier. 

    I'm trying to calculate the date and time separately then concatenate them at the end. Calculating the Time is giving me troubles. 

    Can anyone see what I'm missing?

    Excel sheet with date times that LOOK like this: 

    5/4/2021 6:51:27 PM

     

    When imported to Flow, they LOOK like this:

    44320.7857291667

     

    I'm trying to convert to a friendly format for performing calculations (greater than date, etc.). Can't seem to get the time right. 

     

    For each row in the Excel sheet: 

     

    1. Split the incoming decimal using: 

     

     

    first(
     split(
     items('Apply_to_each')?['dateTimeStamp'],
     '.'
     )
    )

     

     

    2. Use first part of split to calculate date: (This works)

     

     

    formatDateTime(
     addDays(
     '1899-12-30', 
     int(
     outputs('split_action')
     )
     ),
     'MM/dd/yyyy'
    )

     

     

    - Results in: 05/04/2021

     

    3.  Split incoming decimal, take last part:

     

     

    last(
     split(
     items('Apply_to_each')?['dateTimeStamp'],
     '.'
     )
    )

     

     

    4. Use last part of split to calculate time (This does NOT work):

     

     

    formatDateTime(
     addToTime(
     '1970-01-01T00:00:00Z', 
     int(
     string(
     div(
     float(
     outputs('split_action_2') 
     ),
     86400
     )
     )
     ),
     'Second'
     ),
     'HH:mm:ss tt'
    )

     

     

     - Results in: 19:14:08 PM

  • catalincirjan_0 Profile Picture
    2 on 22 Jan 2021 at 17:00:50
    Re: Excel dates turned into integers?

    I hope this is not consider off-topic

    I have made a flow to send certain email that in the body would contain a date ( from the column 'Planned date' in an online excel sheet )

    In the excel, the date in the following format 08 February 2021 ( in the formula bar it's showing as 2/8/2021 )

    first iteration of the flow on 20th of  Jan: The email showed the date as: 2021-02-08T00:00:00.000Z   // dynamic content - Planned Date
    second iteration of the flow on 20th of  Jan with formatting formula format Date Time :  2021-02-08 (easy fix)

    3rd iteration on the 22nd  of Jan (presenting to manager): error - format Date Time formula not working. Checked without formula, just the dynamic content -> 44235   

     

    Thus, me writing on the forum right now.

    Is there a logical explanation for this?

  • Community Power Platform Member Profile Picture
    on 31 Aug 2020 at 15:50:44
    Re: Excel dates turned into integers?

    @Nanig 
    You have to put that expression into a Compose action and then use the Output of that action as the value you save to SharePoint. 

    For me, Step 1 was to set a variable with the value from Excel. This will automatically go into an Apply to Each loop:

    set var date.PNG

     

    If this value is formatted as a DATE in Excel, Flow will see it as an integer. So Step 2 is to check for the presence of a forward slash ( / 😞

    date-slash.PNG

     

    If the condition detects a forward slash, then this date value is formatted as text and I can write it to SharePoint directly as-is. BUT if this condition comes back as false, I know that the value is a Date in Excel, that Flow now sees it as an integer, and I need to use a Compose action to turn that integer back into a human-readable date:
    compose-date.PNG

    I want to write the Output of this Compose action to a SharePoint date column. As you can see, some values are simple text or numbers that I can save to SharePoint directly from Excel (the green boxes below -- this is all using the Create Item action for SharePoint), but for the Work Date field, I want to plug in the Outputs of the Compose action.

    compose-outputs.png

     

    Does that help at all?

  • Nanig Profile Picture
    23 on 29 Aug 2020 at 11:47:37
    Re: Excel dates turned into integers?

    Where are we supposed to add this expression? when I try to set Variable for this I am not able to select the string in formula

  • arowse_pfl Profile Picture
    7 on 27 Jul 2020 at 17:44:32
    Re: Excel dates turned into integers?

    For those struggling with this (and specifically with just a plain time value), here is a expression that can be used to convert the float value into a time string. The extra conditional is needed to handle the case when there is no value. It comes across as a " " value and the subsequent number casts DO NOT like empty values.

     

    I imagine this could be adapted to work for full dates as well.

     

    if(equals(trim(item()?['Hours Weekday Open']), ''), null, formatDateTime(addToTime('1970-01-01T00:00:00Z', int(string(mul(float(item()?['Hours Weekday Open']), 86400))), 'Second'), 'HH:mm tt'))

     

  • ResRudeBoy Profile Picture
    106 on 14 Jul 2020 at 07:28:16
    Re: Excel dates turned into integers?

    Sorry, i dont know, i found the input of date formats have to be MM/dd/yyyy (i cant change the local settings as im not an admin)

     

    So i adjusted my script which outputs my data from AD to bring the date format out in that format 

     

    @{Name="LastLogonDate";Expression={$_.LastLogonDate.ToString('MM/dd/yyyy')}} is what i used in my powershell export, then in sharepoint i just changed the input field to date format and it imports fine. no calculations on the field or in my flow.

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,743 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,081 Most Valuable Professional

Leaderboard
Loading started