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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to remove top few ...
Power Automate
Unanswered

How to remove top few lines of an excel file that does not have a table

(2) ShareShare
ReportReport
Posted on by 256

Every step I attempt with power automate shows me another hurdle I can't get past. My other questions can't get resolved unless I now have this step completed.

 

I have an excel file which is an export of data from another application (XLSX format). The excel document does not have a table, because the flow that creates a table breaks due to the fact that this excel file has document information at the top of the excel file, that needs to be deleted before a table can be created.

 

Is there any way to remove the top 14 lines of an excel file (14 lines of document information) using power automate? But keep in mind there's no table. 

 

If a table is required for this to happen, then how could I create a table in an excel document that ignores the first 14 lines of information, so I can delete it after the table is created?

 

Thanks in advance

Categories:
I have the same question (0)
  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @galos 

     

    Could you attach a sample file which I can try from my end?

     

    Thanks

  • galos Profile Picture
    256 on at

    I had to anonymize and reduce the file size, so only a few lines here, but the data would be much larger. Let me know if this helps. I tried to keep the formatting identical

  • galos Profile Picture
    256 on at

    Had to delete the last one and update it with one item. Here is an updated copy with anonymized data

     

    appreciate your help @abm !

  • galos Profile Picture
    256 on at

    @abm I'm wondering if using OFFSET/SUBTOTAL would work here? I wonder if there's a way to start with the header row and end with an empty cell (as each time the report generates, it can be a different length / # of rows). If you noticed, the output that is generated to this excel file (from our application) breaks the standard A1:A$ cell names. It's strange with R and C?

  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @galos 

     

    Thanks for sending the anonymize file. Let me try and see. Will give you an update soon.

     

    Thanks

  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @galos 

     

    I got a solution for you. I have tested this and working as expected. I will make a video for this soon.

     

    Thanks

     

     

  • galos Profile Picture
    256 on at

    @abm excited to see what you did!

  • creativeopinion Profile Picture
    10,502 Super User 2025 Season 2 on at

    You can try this Excel automation script. Add it to Excel.

    function main(workbook: ExcelScript.Workbook, numberOfRowsToDelete: number) {
    	let selectedSheet = workbook.getActiveWorksheet();
    	let startRow = 1;
    	let endRow = startRow + numberOfRowsToDelete - 1;
    	let rangeToDelete = selectedSheet.getRange(`${startRow}:${endRow}`);
    	rangeToDelete.delete(ExcelScript.DeleteShiftDirection.up);
    }

     

    In your flow, add a Run Script action and select the script. You can specify the number of rows to delete by entering it in the last field.

    creativeopinion_0-1689796659661.png

    You can then run another script that will create a table(s) for you. I recently posted a video that goes through this process: https://youtu.be/GNLhPqP1cjM

     

    If I helped you solve your problem—please mark my post as a solution ✅.
    Consider giving me a 👍 if you liked my response!

    👉 Watch my tutorials on YouTube
    👉 Tips and Tricks on TikTok

     

  • galos Profile Picture
    256 on at

    Thank you @creativeopinion  ! I will try this. One question though - is the excel automation script something that needs to be in the excel file prior to running it with power automate? Because I need to automate this process and adding that in manually to an excel file will break the flow. Can power automate add that function into the excel file?

  • galos Profile Picture
    256 on at

    Oh I see, this script is to be put directly into it's own excel file and run, correct? If that's the case, how do I get it to point that action of deleting 14 rows to the other file I have? Sorry I'm not an advanced power automate user yet, still at basic level, but I do have a strong background on other power products

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard