Fix Office Script Timeouts When Deleting Excel Table Rows
Question details
The user needs to prevent Power Automate from timing out when using an Office Script to delete a massive number of rows in an Excel table.

- Product
- Microsoft Excel and Power Automate
- Device & OS
- not provided
- Scenario
- Automating Excel data cleanup by running an Office Script via a Power Automate flow to remove unwanted table rows.
- Observed behavior
- The Power Automate flow exceeds the execution time limit and throws a timeout error because deleting many rows iteratively takes too long.
Verify your Power Automate connector limits and ensure your Excel file is securely saved in an active SharePoint or OneDrive business account before modifying the script logic.
Implement Batch Processing for Row Deletion
Reduce the workload of a single script execution by processing and deleting table rows in smaller, manageable batches to avoid hitting the timeout limit.
Office Scripts have a strict execution time limit (usually 120 seconds). When a script loops through thousands of rows to delete them, the constant recalculation and shifting of rows consume significant resources. Splitting this operation into chunks ensures the script finishes within the allowed timeframe.
Navigate to your Power Automate flow, open the Run History, and identify exactly which script action is failing and how long it takes before timing out.
Edit your Office Script to include a counter limit. Instead of deleting all matching rows, configure the script to find and delete only the first 500 or 1,000 matching rows, then return a status indicating if more rows remain.
In your Power Automate flow, place the 'Run script' action inside a 'Do until' loop. Set the loop to repeat the script execution until the script returns a status confirming no further rows need deletion.

Redesign the Workbook Data Flow
Bypass the slow process of row deletion entirely by copying the data you want to keep into a new table or worksheet.
Seek Specialized Power Automate Assistance
Consult Microsoft community experts when standard optimizations do not resolve complex flow timeouts.
Experience Faster Data Processing with WPS Office
If you frequently manage massive datasets and encounter performance bottlenecks, timeouts, or high subscription costs with Microsoft Excel, consider switching to WPS Office. WPS Spreadsheet is a lightweight, highly efficient alternative designed to handle large tables smoothly.

Frequently Asked Questions
What is the maximum time limit for an Office Script to run in Power Automate?
A single Office Script action triggered via Power Automate generally has a strict timeout limit of 120 seconds. If the data processing takes longer than this duration, the flow will automatically fail.
Why does deleting rows take so much longer than editing cells?
Deleting rows in an Excel table forces the application to shift all subsequent data up and recalculate the table's structural references and formulas. Repeating this process iteratively for thousands of rows causes severe performance lag.
Does clearing cell values run faster than deleting rows?
Yes. Clearing the contents of a range using the clear() method is significantly faster because it only removes the cell data without altering the overall table structure or forcing Excel to shift remaining rows.
Can I increase the timeout limit for the Excel Online connector?
No, the timeout limit for the Excel Online (Business) connector and Office Scripts is hardcoded by Microsoft to ensure server stability. You must optimize your script or use batching to stay within the existing 120-second limit.




