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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / ODATA Filter query bas...
Power Automate
Unanswered

ODATA Filter query based on date from excel onedrive

(0) ShareShare
ReportReport
Posted on by 23

Hi,

Beginner needs help to filter data from excel table in onedrive using ODATA filter query based on date field in excel. Query will be on "List rows present in a table" option. I understand excel returns a string as number for dates stored in excel. How can I compare this number string against utcNow to filter data.

Thanks

Santhosh

Categories:
I have the same question (0)
  • Verified answer
    efialttes Profile Picture
    14,756 on at

    Hi!

    In my example, the excel column con Date format is called 'TestingDate'

    Here you are the expression I use in my ODATA filter to filter records whose TestingDate is today:

    TestingDate eq 'add(div(sub(ticks(utcNow('MM/dd/yyyy')),ticks('1900/01/01')),864000000000),2)'

     

    Please note I am adding an expression inside single quotes this way:

    Flow-DatesBack2Excel_2.png

    Hope this helps

     

     

  • Santhosh72 Profile Picture
    23 on at

    Thanks, It worked.

    Grateful if you can also help me with my previous question https://powerusers.microsoft.com/t5/Building-Flows/Consolidated-email-based-on-date-in-excel/m-p/471232#M57141

     

  • Santhosh72 Profile Picture
    23 on at

    Hi,

     

    How can I use "greater than" or "less than" operator instead or "eq" operator in the filter?

     

    Thanks

    Suji

  • RobElliott Profile Picture
    10,323 Super User 2025 Season 2 on at

    gt = greater than

    ge = greater than or equal to

    lt = less than

    le = less than or equal to

    Rob
    Los Gallardos
    If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

  • Santhosh72 Profile Picture
    23 on at

    Dear @RobElliott ,

    Since we are comparing two strings, I dont think these will work. I tried and got unsupported operator error.

    Thanks

    Santhosh

     

     

  • RobElliott Profile Picture
    10,323 Super User 2025 Season 2 on at

    I hadn't read the rest of the thread when I posted, just your most recent question. It is, as you have realised, not possible or logical to say greater than or less than a string value.

    Rob
    Los Gallardos

  • Santhosh72 Profile Picture
    23 on at
    So is there any other way of filtering excel dates using less than or greater than operator?
    Thanks
    Santhosh
  • RobElliott Profile Picture
    10,323 Super User 2025 Season 2 on at

    Yes there is using the ticks expression (nanoseconds since 1st January 1601) but I don't think there's a way of doing this with a filter query, you have to do it with a series of Compose controls in the body of the flow.

    After your List rows present in a table, the first control inside the apply to each is a Compose to get the date from each item in the Excel spreadsheet:
    0-listRows.png

    Next, inside another Compose turn that into an integer using int(outputs('Compose_Date')). Next, calculate the number of ticks of the integer by doing a multiplication inside another Compose using
    add(mul(outputs('Compose_Integer'),864000000000),599264352000000000)
    1-ComposeIntegerResult.png

    Next, add another Compose to get the ticks value from the start of today using the expression ticks(startOfDay(utcNow()))

    Finally, add a condition. In my example I'm checking of the date column in the spreadsheet is greater than today's date, i.e in the future.

    2-composeCondition.png

    The flow will run and do a comparison of the date in the Excel column against today's date.

    Rob
    Los Gallardos
    If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard