logo
search
VBA & Macro Problems

How to Fix Office Scripts Not Copying Formulas in Excel Worksheets

Partner EditorPartner Editor Sep 30, 2026 868 views

Question details

The user needs to know how to resolve an issue where an Office Script fails to copy formulas across Excel worksheets or tables.

How to Fix Office Scripts Not Copying Formulas in Excel Worksheets
Product
Microsoft Excel
Device & OS
not provided
Scenario
Executing an Office Script to copy data between worksheets, particularly when rows contain formulas, blank cells, hidden columns, or specific formatting.
Observed behavior
The Office Script copies only the static values, stripping away the underlying formulas and calculations during the paste operation.
Before you start

Review your Office Script code to identify the exact functions handling the copy-paste operation, and ensure you have a sample dataset ready to reproduce the issue.

Solution 1Recommended

Seek Specialized Code Support on Stack Overflow

Because Office Scripts require specific TypeScript coding expertise, posting your code to a developer community like Stack Overflow is the most effective way to get a tailored fix.

Microsoft's Office Scripts operate using specialized TypeScript/JavaScript APIs. When default methods fail to carry over formulas, or when dealing with complex ranges involving hidden columns and blank cells, custom code adjustments are usually required.

1
Prepare a reproducible example

Create a minimal, safe version of your Excel workbook that contains the table structure, formulas, and any blank or hidden columns relevant to your issue.

2
Extract your Office Script

Open the Code Editor in Excel, highlight your entire TypeScript or JavaScript code, and copy it to your clipboard.

3
Draft a clear question

Go to Stack Overflow and write a concise title. In the body, explain exactly how formulas, filters, hidden columns, and formatting should be handled, and state that the script currently pastes values instead.

4
Add relevant tags

Tag your question with 'excel', 'office-scripts', and 'typescript' to ensure it reaches developers who are experts in this specific Microsoft ecosystem.

Seek Specialized Code Support on Stack Overflow
Third-Party Support Notice: Microsoft does not provide direct guarantees or official support for third-party sites like Stack Overflow, but it remains the officially recommended hub for developer coding inquiries.
Free Microsoft Office alternative

Experience Seamless Formula Handling with WPS Office

If Microsoft Excel's Office Scripts are proving too complex for your automation needs, consider WPS Office. It is a powerful, lightweight alternative that handles cross-sheet formula copying flawlessly without requiring advanced coding skills.

  1. 1. Download the Installer: Visit the official WPS Office website and click on the 'Download WPS Office Free' button.
  2. 2. Install WPS Office: Run the downloaded installation file and follow the straightforward on-screen instructions.
  3. 3. Open Your Workbooks: Launch WPS Spreadsheets, open your existing .xlsx files, and effortlessly manage your formulas and data.
Highly compatible with Microsoft Excel formats (.xlsx, .xls, .csv)Easily copy and paste formulas across sheets using a familiar interfaceSupports standard VBA and JS Macros for accessible spreadsheet automationFree and lightweight software that runs smoothly on older devices
microsoft office alternative - wps office

Frequently Asked Questions

Why does my Excel Office Script only paste values by default?

Many default range copy methods in Office Scripts are designed to extract only the static values to optimize performance. To copy formulas, you typically need to specify parameters like RangeCopyType.formulas when using the copyFrom method.

How do hidden columns or filters affect copying in Office Scripts?

Hidden columns or filtered rows can disrupt standard script operations. Unless explicitly coded to bypass or include hidden cells (for example, by targeting only visible cells), the script might read data incorrectly, resulting in misaligned pastes.

Can I use VBA instead of Office Scripts to copy formulas?

Yes, VBA is widely used in desktop versions of Excel to automate tasks, including copying formulas. However, Office Scripts are specifically designed for Excel on the Web and cross-platform automation where VBA is not supported.