cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
frixel
Post Prodigy
Post Prodigy

Counting rows from a csv file

Hello all,

I try to make a Flow for counting rows from a csv file.

 

This what i make but i have the error. What goes wrong?

 

1.png2.png

1 ACCEPTED SOLUTION

Accepted Solutions
v-bofeng-msft
Community Support
Community Support

Hi @frixel :

Do you want to get the number of rows in a CSV file?

Firstly,let me explain why you encountered this problem.

The point is that the content of a CSV file is a string.

v-bofeng-msft_0-1623810948884.png

I think this link will help you a lot:

What Is a CSV File, and How Do I Open It?

Secondly,You can get the number of rows by parsing the csv text.I'v made a test for your reference:

My CSV

v-bofeng-msft_3-1623811207002.png

My Flow

v-bofeng-msft_1-1623811152477.png

The Restul:

v-bofeng-msft_2-1623811184590.png

Best Regards,

Bof

 

 

View solution in original post

4 REPLIES 4
v-bofeng-msft
Community Support
Community Support

Hi @frixel :

Do you want to get the number of rows in a CSV file?

Firstly,let me explain why you encountered this problem.

The point is that the content of a CSV file is a string.

v-bofeng-msft_0-1623810948884.png

I think this link will help you a lot:

What Is a CSV File, and How Do I Open It?

Secondly,You can get the number of rows by parsing the csv text.I'v made a test for your reference:

My CSV

v-bofeng-msft_3-1623811207002.png

My Flow

v-bofeng-msft_1-1623811152477.png

The Restul:

v-bofeng-msft_2-1623811184590.png

Best Regards,

Bof

 

 

@v-bofeng-msft 

 

Thanks, that really helps me a lot.


Now I had designated a specific file in my flow (get file content) but how do I adjust the flow if it has to be the file that comes(new) in that folder?

Hi @frixel :

If you just want to get the newly created file under the specified path, you only need to sort the creation time and get the last record.For example:

v-bofeng-msft_0-1623824838536.png

In addition,this is a question unrelated to the current topic, I would suggest you to consider creating a new thread.

Best Regards,

Bof

 

Thanks, this worked for me!  The only difference was that I had to subtract 2 from the total row count instead of 1. When I created the csv table (from a get rows in SQL table action), the csv table output had the header row, the data rows, then one extra blank row.  Not sure what caused the blank row, but in the end, if I subtracted 2 in the final compose statement, the results were correct.

Runner55552_0-1630369751370.png

sub(length(outputs('Compose')), 2)

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events happening this month - don't miss out!

 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Users online (3,087)