Notifications
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.
In our never-ending quest to improve we are simplifying the forum hierarchy…
We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Michael E. Gernaey 503 Super User 2025 Season 2
Tomac 321 Moderator
abm abm 237 Most Valuable Professional