Skip to main content

Notifications

Community site session details

Community site session details

Session Id : MVzhG5HZg3mKuDDhURDNWT
Power Automate - General Discussion
Answered

Create CSV from SharePoint List with Condition

Like (0) ShareShare
ReportReport
Posted on 8 Apr 2022 12:41:27 by 52

Hello,

 

I had a flow set on a recurrence that gets items from a SharePoint list, creates a CSV, stores it in a different SharePoint list, and then deletes the entries that have been copied to the CSV. It was working fine but then I added a condition based on the start date of the entries. Now, it is creating a separate CSV for each entry that meet the condition instead of creating one CSV for all entries. 

 

CSV Copy.PNG

Categories:
  • kayakingaway Profile Picture
    52 on 08 Apr 2022 at 15:59:09
    Re: Create CSV from SharePoint List with Condition

    Those would be the correct rows that I want to pull but the CSV being created is pulling all the data currently in the SharePoint List. 

  • Verified answer
    Expiscornovus Profile Picture
    31,411 Most Valuable Professional on 08 Apr 2022 at 15:56:59
    Re: Create CSV from SharePoint List with Condition

    Hi @kayakingaway,

     

    With the current filter you are retrieving all the items which have a start date which is 2022-03-25 or before that date (today-14). 

     

    Which rows are you trying to retrieve? Based on your expression I assume all items which have a Start Date from 2022-03-25 till today?

     

    In that case you could use an expression in the advanced mode of the Filter Array action like below:

     

     

    @and(greaterOrEquals(item()?['StartDate'], formatDateTime(addDays(utcNow(), -14), 'yyyy-MM-dd')),lessOrEquals(item()?['StartDate'], formatDateTime(utcNow(), 'yyyy-MM-dd')))

     

     

    filterarray_advancedmode_expression.png

     

  • kayakingaway Profile Picture
    52 on 08 Apr 2022 at 15:36:40
    Re: Create CSV from SharePoint List with Condition

    The data entries fitting my date filter array**

  • kayakingaway Profile Picture
    52 on 08 Apr 2022 at 15:36:13
    Re: Create CSV from SharePoint List with Condition

    Thanks for the suggestion! I tried this out and it did solve the issue of the separate CSVs but it is pulling all my data into the CSV not just the data entries fitting the date filter array written as followed: 

    formatDateTime(addDays(utcNow(), -14), 'yyyy-MM-dd'). I tried to create the CSV from Body and from value with same issue. Any ideas? I appreciate the help!
  • Expiscornovus Profile Picture
    31,411 Most Valuable Professional on 08 Apr 2022 at 13:14:34
    Re: Create CSV from SharePoint List with Condition

    Hi @kayakingaway,

     

    Instead of your condition action you could also use either a Filter Query (OData) in your Get items or a Filter Array action.

     

    The Filter Array action looks pretty similar to the condition. So, that is probably the easiest to use.

     

    Below is an example of that Filter Array approach.

    As you can see you don't need an apply to each loop within this approach.

     

    filterarray_action.png

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

Thomas Rice – Community Spotlight

We are honored to recognize Thomas Rice as our March 2025 Community…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,508 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,440 Most Valuable Professional

Leaderboard
Loading complete