Announcements
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!
Hi @dazler5540 ,
I made a sample for you.
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
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}`; } }
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.
Congratulations to our 2026 Super Users!
Congratulations to our 2025 community superstars!
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Haque 523
Valantis 318
David_MA 235 Super User 2026 Season 1