Excel Performance Problems

Fix Office Scripts Running Slowly from Excel Buttons

Jason MillerJason Miller Oct 19, 2026 869 views

Question details

The user needs to resolve an issue where Office Scripts freeze or take a long time to execute when triggered via worksheet buttons in Excel.

How to Fix Office Scripts Running Slowly from Excel Worksheet Buttons
Product
Microsoft Excel
Device & OS
not provided
Scenario
Triggering Office Scripts repeatedly using in-sheet buttons during regular spreadsheet workflows.
Observed behavior
Scripts run normally when executed manually but become extremely slow or get stuck on 'Preparing to run button' when repeatedly started from Excel buttons.
Before you start

Ensure your Excel application and web browser are fully updated to the latest versions, and verify that your internet connection is stable if using Excel for the Web.

Solution 1Recommended

Optimize Script Performance and Refresh the Browser Session

Minimizing unnecessary API calls and clearing long-running browser sessions can prevent scripts from hanging.

Office Scripts performance is heavily dependent on the Excel web client. Repeatedly running scripts from buttons can accumulate memory and cache in the browser session, causing lag.

1
Review Script Code

Check your Office Script code to minimize Excel API calls and remove unnecessary console logging.

2
Restart the Session

Close your current browser tab or Excel application to clear active memory.

3
Re-test the Button

Reopen the browser or Excel, navigate back to your workbook, and test the button again to see if the session reset resolved the lag.

Optimize Script Performance and Refresh the Browser Session
Web Client Performance: If you are running scripts heavily on Excel on the web, frequent page refreshes may be required to free up browser memory resources.
Free Microsoft Office alternative

Experience Smooth Spreadsheet Automation with WPS Office

If Microsoft Excel continues to freeze when running automated scripts, consider switching to WPS Office. It provides a lightweight, highly compatible alternative with robust JS Macro support for smooth automation without the heavy resource drain.

  1. 1. Download WPS Office: Download and install WPS Office for free from the official website.
  2. 2. Open Your Workbook: Launch WPS Spreadsheets and open your existing Excel workbook.
  3. 3. Run Macros Seamlessly: Utilize the lightweight WPS environment to run macros and automation scripts without performance lag.
Free and lightweight alternative to Microsoft Office.Fully compatible with Microsoft Excel file formats (.xlsx, .xlsm).Built-in support for JS Macros for efficient and smooth spreadsheet automation.Familiar user interface requiring no learning curve.
QA img-9

Frequently Asked Questions

Why do my Office Scripts run fine manually but lag when using a button?

Running scripts from a button can sometimes trigger different event handlers or accumulate web client session data differently than a manual run, leading to memory bloat or interface lag over multiple rapid executions.

Does clearing my browser cache help with Excel web script performance?

Yes, if you are using Excel on the Web, clearing your browser's cache and cookies can resolve session-related hangs and improve the overall execution speed of your Office Scripts.

Can third-party add-ins affect Office Script execution?

Absolutely. Active X or COM add-ins can conflict with the underlying processes Excel uses to trigger scripts from sheet buttons, causing them to freeze or stall indefinitely on the 'Preparing to run button' screen.