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 / Scheduled Flow for del...
Power Automate
Suggested Answer

Scheduled Flow for deleting contents in table

(0) ShareShare
ReportReport
Posted on by

Hello Community,

 

I want to learn how to delete the contents of a given table in excel in OneDrive using Power Automate Scheduled Flow. It must be triggered at a designated day and time. Please help!

 

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

    Hi @dazler5540 ,

     

    I made a sample for you.

    vxiaochenmsft_0-1676864047069.png

    vxiaochenmsft_1-1676864054954.png

     

    Please make sure that Excel table has a primary column (In my screenshots, it's Col1.) because Power Automate doesn’t allow you to remove empty rows from an Excel file. The ‘Delete a row’ action needs an identifier of the specific row, and it can’t be empty. 

     

    Best Regards,

    Wearsky

  • Suggested answer
    CU17101209-0 Profile Picture
    2 on at
    Just recently ran into this problem myself, and I don't like using the list all rows, delete row combination since it deletes rows one at a time and that can be super slow for tables of more than 100 rows.
     
     
    The approach I used was using an Office Script. The script body is:
     
    function main(workbook: ExcelScript.Workbook, tableName: string): string{
      const tbl = workbook.getTable(tableName);
    
      if (!tbl){
        let tbls = workbook.getTables();
        let names = tbls.map(tbl => tbl.getName()).join(', ');
        return `[ERROR] No table found ${tableName}. Found tables:\n[${names}]`;
      }
    
      try {
        // This could be made more complicated for really large tables > 1 million rows to avoid timeout errors
        tbl.getRangeBetweenHeaderAndTotal().delete(ExcelScript.DeleteShiftDirection.up);
        return "Success"
      }
      catch(e){
        return `[ERROR] Unable to delete table range. Received error:\n${e}`;
      }
    }
     
    Then you simply make a power automate flow, using the "Run Script" action
    In the above example I'm using a manual trigger, but that could super easily be changed to a scheduled trigger.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 523

#2
Valantis Profile Picture

Valantis 318

#3
David_MA Profile Picture

David_MA 235 Super User 2026 Season 1

Last 30 days Overall leaderboard