Excel Performance Problems

Fix Office Script Timeouts When Deleting Excel Table Rows

Amos GikundaAmos Gikunda Oct 21, 2026 870 views

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.

How to Fix Office Script Timeouts When Deleting Excel Table Rows
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.
Before you start

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.

Solution 1Recommended

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.

1
Review Power Automate run history

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.

2
Modify the Office Script for batching

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.

3
Add a Do-Until loop in Power Automate

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.

Implement Batch Processing for Row Deletion
Calculation Optimization: You can further improve execution speed by adding code at the start of your script to set workbook calculation to manual, and restoring it to automatic at the end.
Free Microsoft Office alternative

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.

Seamlessly compatible with Microsoft Excel (.xlsx, .xls, .csv) and standard macro formats.Lightweight software architecture ensures faster opening and manipulation of large datasets without freezing.Familiar user interface requires zero learning curve, allowing for an effortless migration.Advanced built-in tools for efficient data processing, filtering, and table management completely free of charge.
microsoft office alternative - wps office

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.