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 / Filter query to get fi...
Power Automate
Answered

Filter query to get files from today only

(2) ShareShare
ReportReport
Posted on by 41

Hello,

 

I wrote a PAD flow that takes files from a SharePoint library and downloads it to my local computer.  That goes through with no issue, but I am trying to update the flow to only download the files that were uploaded today.  I saw a filter query but getting error of bad request.  I tried this in the step "  formatDateTime(items('Foreach')?['createdDateTime'], 'yyyy-MM-dd') eq formatDateTime(utcNow(), 'yyyy-MM-dd')  " 

I have the same question (0)
  • Sayan Profile Picture
    818 Moderator on at

    Hey @Patrick_Perea 

     

    Can you please share the workflow ?

     

    ------------------------------------------------------------------------------------------------------------------------------

    If my suggestion helped you, please give it a Thumbs up 👍 and Mark it as a Solution ✔️.

    This motivates me to solve more problems.

     

    Thanks,

    Sayan Patra

    RPA Developer

  • Patrick_Perea Profile Picture
    41 on at

    Patrick_Perea_0-1720631565269.png

     

    Patrick_Perea_1-1720631609052.pngPatrick_Perea_2-1720631633628.png

     

  • Deenuji_Loganathan_ Profile Picture
    6,250 Moderator on at

    @Patrick_Perea 

     

    Please find the below screenshot to apply filter in SharePoint file actions

     

    Deenuji_0-1720633795496.png

     

    Created ge '2024-07-09T00:00:00.0000000Z' and Created lt '2024-07-10T00:00:00.0000000Z'

     

    In filter query syntax, ge means "greater than or equals to" and lt means "less than"


    Thanks,
    Deenuji Loganathan 👩‍💻
    Power Automate Desktop Community Champion 🤖
    Follow me on LinkedIn 👥

    -------------------------------------------------------------------------------------------------------------
    If I've helped solve your query, kindly mark my response as the solution ✔ and give it a thumbs up!👍 Your feedback supports future seekers 🚀

  • Patrick_Perea Profile Picture
    41 on at

    Since this is going to be used from here on out can I remove the date with utcNow()

  • Patrick_Perea Profile Picture
    41 on at

    Thank you for the code but that wont work, when the user uploads a new file tomorrow 

  • Sayan Profile Picture
    818 Moderator on at

     

     

    Hey @Patrick_Perea 

     

    Try the below expression to get the file 

     

    Created ge '2024-07-10T00:00:00Z'

    This expression retrieves items created on or after July 11, 2024 (in UTC time).

     

     

    Sayan_0-1720641906179.png

     

    ------------------------------------------------------------------------------------------------------------------------------

    If my suggestion helped you, please give it a Thumbs up 👍 and and Mark it as a Solution ✔️.

    This motivates me to solve more problems.

    Thanks,

    Sayan Patra

    RPA Developer

     

     

  • Patrick_Perea Profile Picture
    41 on at

    That would not work this is a flow used multiple days and that script would only work for today.

  • Verified answer
    Deenuji_Loganathan_ Profile Picture
    6,250 Moderator on at

    @Patrick_Perea 

     

    You make it dynamic this logic using below actions:

    Deenuji_0-1720671405187.png

    Filter applied for SharePoint get files action with two variables:

    Deenuji_1-1720671457247.png

     

     

    Code (Copy and paste the below code into your power automate desktop):

    DateTime.GetCurrentDateTime.Local DateTimeFormat: DateTime.DateTimeFormat.DateAndTime CurrentDateTime=> CurrentDateTime
    Text.ConvertDateTimeToText.FromCustomDateTime DateTime: CurrentDateTime CustomFormat: $'''yyyy-MM-dd''' Result=> FormattedDateTime
    SET FromDate TO $'''%FormattedDateTime%T00:00:00.0000000Z'''
    SET ToDate TO $'''%FormattedDateTime%T23:59:59.9999999Z'''

     


    Thanks,
    Deenuji Loganathan 👩‍💻
    Power Automate Desktop Community Champion 🤖
    Follow me on LinkedIn 👥

    -------------------------------------------------------------------------------------------------------------
    If I've helped solve your query, kindly mark my response as the solution ✔ and give it a thumbs up!👍 Your feedback supports future seekers 🚀

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    Just to add to what @Deenuji suggested (as their suggestion is correct) - the reason you need extra actions is because utcNow() and formatDateTime() are expressions that work in cloud flows, but not desktop flows. We don't have those expressions in PAD (except when you enable Power Fx, but that changes the syntax everywhere), and we need to use dedicated actions to perform those operations, such as Get current date time and Convert date time to text.

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
Haque Profile Picture

Haque 612

#2
Valantis Profile Picture

Valantis 344

#3
11manish Profile Picture

11manish 326

Last 30 days Overall leaderboard