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 / Delete First Line of T...
Power Automate
Unanswered

Delete First Line of Text in txt file

(1) ShareShare
ReportReport
Posted on by 19

Hi all,

 

I have a .txt file that contains header information. I would like to remove that information, save the file/create a new file, and put it in a different folder.

 

I'm not sure how to remove the first line. Here are the steps i am trying:

  1. If the list exists
    1. Read the file contents
    2. Create a list
    3. Add the file contents to the list
    4. ** remove the first row somehow**
    5. ** write the remainder of the list to a new txt file**
    6. save that file to the appropriate location.

I need help on steps 4 and 5. Not sure  how to remove/delete List[0] and then create a new file.

I have the same question (0)
  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    Edit:  After deleting the row, use PAD Save As Excel to pick your path, filename, and extension (.xlsx .csv .txt, etc.)

     

    Use send keys to navigate through Excel to delete the row and resave the file:

     

    MichaelAnnis_0-1642526737793.png

    Those 2 are red because I don't have a filepath or filename variable.

     

    Be sure to set the time between keystrokes on the 'Send Keys {Alt}()fao' to 100, as the Excel menu is just a little slower on hot keys.  You could set all the send keys to 100 if you want to just give it more time all around.

     

    So, walking through it:  Make sure the window is the focused window before you start

    • Control + Home will go to A1
    • Control + Minus will try to delete, but should bring up an ask box for cell or row
    • Alt + r selects entire row
    • Enter clicks ok

    Edit:  Then use PAD to Save As the Excel File.

     

    • Alt f a o (notice alt is not held down, that is why fao is outside the parenthesis) is File -> Save As -> Browse
    • Wait for the File Name text field element
    • FilePath and Enter will take the browse to the folder you want
    • Wait 1
    • FileName and Enter will save the file

    Good luck!

  • PAG Profile Picture
    154 on at

    Hello @kenthub ,

    Maybe this will work?

    https://power.automate.gallery/UevrYxqoZEbt 

  • UK_Mike Profile Picture
    on at

    Jeeeezzz

    No chance of a terrorist attack with PDA is there ? 😂

    I would record a Macro, just delete the first row surely.

    I just find sending keys can be flaky, rarely I know but it does happen.

  • kenthub Profile Picture
    19 on at

    Thanks for this. I just opened the file in excel, removed the first row, and closed and saved it where I wanted. 

     

    Luckily the file formatted well coming across! 

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
David_MA Profile Picture

David_MA 248 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 204

#3
Haque Profile Picture

Haque 179

Last 30 days Overall leaderboard