cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
Dual Super User
Dual Super User

Re: Filtering out CSV files without information

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
Highlighted
Dual Super User
Dual Super User

Re: Filtering out CSV files without information

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

Highlighted
New Member

Re: Filtering out CSV files without information

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
firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Users online (7,344)