Skip to main content

Notifications

Power Automate - General Discussion
Answered

Create CSV from SharePoint List with Condition

(0) ShareShare
ReportReport
Posted on 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
    kayakingaway 52 on at
    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
    Expiscornovus 31,089 on at
    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
    kayakingaway 52 on at
    Re: Create CSV from SharePoint List with Condition

    The data entries fitting my date filter array**

  • kayakingaway Profile Picture
    kayakingaway 52 on at
    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
    Expiscornovus 31,089 on at
    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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

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

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,445

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,741

Leaderboard