Skip to main content

Notifications

Community site session details

Community site session details

Session Id : H82LVOitD0xtknt19PkbOl
Power Automate - Building Flows
Answered

Counting rows from a csv file

Like (0) ShareShare
ReportReport
Posted on 15 Jun 2021 10:22:36 by 901

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

  • 55552 Profile Picture
    667 on 31 Aug 2021 at 00:29:45
    Re: Counting rows from a csv file

    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)
  • v-bofeng-msft Profile Picture
    on 16 Jun 2021 at 06:30:07
    Re: Counting rows from a csv file

    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

     

  • frixel Profile Picture
    901 on 16 Jun 2021 at 06:18:01
    Re: Counting rows from a csv file

    @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?

  • Verified answer
    v-bofeng-msft Profile Picture
    on 16 Jun 2021 at 02:40:34
    Re: Counting rows from a csv file

    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

     

     

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Automate - Building Flows

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 18 Super User 2025 Season 1

#2
stampcoin Profile Picture

stampcoin 14

#3
Churchy Profile Picture

Churchy 12

Overall leaderboard
Loading started