cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
El_Capitan
New Member

Filtering out CSV files without information

Hi,

 

I'm currently working on a flow which should download csv files that are received in a specific Outlook email address, and upload them to a sharepoint folder.

This is going well, but our follow-up work is disrupted by some csv files with only the column names, so without any data. My goal is to filter these csv files.

 

Unfortunately the incoming csv files cannot be altered as they're coming from an outside source.

 

The current flow setup is as follows: 

- Only select emails with attachments and other necessary requirements.

- Concatenate the current datetime + attachment name.

- Save the file to a specified Sharepoint folder with the new name.

 

Are there any suggestions of ways that I could solve this? Help is greatly appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
efialttes
Super User III
Super User III

Hi!

I think you need to read the CSV file and check if more than one rows is defined (i.e. it contains valid data other than just headers), right?

Good stuff here

https://sharepains.com/2020/03/09/read-csv-files-from-sharepoint/

 

Following this link's recommendations you can calculate nr of elements contained by 'Filter array' output with the following expression

length(body('Filter_array'))

If 1, then delete the CSV file.

Hope this helps

 



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



View solution in original post

2 REPLIES 2
efialttes
Super User III
Super User III

Hi!

I think you need to read the CSV file and check if more than one rows is defined (i.e. it contains valid data other than just headers), right?

Good stuff here

https://sharepains.com/2020/03/09/read-csv-files-from-sharepoint/

 

Following this link's recommendations you can calculate nr of elements contained by 'Filter array' output with the following expression

length(body('Filter_array'))

If 1, then delete the CSV file.

Hope this helps

 



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



View solution in original post

Hi efialttes,

 

I tried implementing the solution you offered, and it worked!

 

I had some issues with the 

outputs('Newline')

part of the script on the site. I used a workaround in which I made a 'compose' step, in which I just entered '\n' as the input, which solved the issues.

 

Thanks again! 

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Top Solution Authors
Users online (1,150)