web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Remove first 4 rows an...
Power Automate
Unanswered

Remove first 4 rows and last 5 rows of excel table

(0) ShareShare
ReportReport
Posted on by 48

Hi, I receive a CSV extract of data in email. How would I remove the first 4 rows and last 5 rows and keep everything between, then add the inbetween data to an existing workbook on sharePoint (to the last row of existing workbook data)

Thank you for your help

I have the same question (0)
  • v-chengfen-msft Profile Picture
    Microsoft Employee on at

    Hi @inkbird01 ,

    Here is a test for your reference:

    Here is csv file :

    vchengfenmsft_2-1669872102536.png

    Here is sharepoint excel file:

    vchengfenmsft_3-1669872127585.png

     

    Here is flow:

    [Compose]:split(base64ToString(outputs('Get_Attachment_(V2)')?['body/contentBytes']), decodeUriComponent('%0D%0A'))
    [Apply to each]: take(skip(outputs('Compose'),5),add(length(skip(outputs('Compose'),5)),-6))
    [Split By Comma]: split(first(split(item(),'",')),',')
    trim(outputs('Split_By_Comma')?[0])
    trim(outputs('Split_By_Comma')?[1])
    trim(outputs('Split_By_Comma')?[2])
    trim(outputs('Split_By_Comma')?[3])
    trim(outputs('Split_By_Comma')?[4])
    trim(outputs('Split_By_Comma')?[5])

    vchengfenmsft_0-1669872076244.png

    vchengfenmsft_7-1669872662289.png

     

     

     

    Here is result:

    vchengfenmsft_5-1669872308970.png

     

    Here is a link for your reference:

    Power Automate: Parse CSV files - Thrives

     

    Best Regards

    Cheng Feng

     

     

     

     

  • momlo Profile Picture
    1,527 Super User 2024 Season 1 on at

    Hi @inkbird01 

    I have similar case in one case of my flows where i need to remove couple of "header" rows and couple of "footer" rows from CSV

     

    If you can do id in Power Automate like @v-chengfen-msft suggested, that would be my preference too, but i you need to use Power Automate Desktop, then what I do in that flow:

    1. Read from CSV
    2. Delete bottom rows from  datatable, using index
    3. Delete bottom top from  datatable, using index
    4. Paste data to excel

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 233

#2
David_MA Profile Picture

David_MA 217 Super User 2026 Season 1

#3
Valantis Profile Picture

Valantis 190

Last 30 days Overall leaderboard