VBA & Macro Problems

How to Fix Missing Excel Data Caused by Office Script Sorting

Aamir Naveed AkramAamir Naveed Akram Nov 10, 2026 869 views

Question details

The user experiences missing or truncated values in their Excel spreadsheet after running an Office Script to sort a large data range.

How to Fix Missing Excel Data Caused by Office Script Sorting
Product
Microsoft Excel
Device & OS
not provided
Scenario
Sorting large datasets containing many columns using Office Scripts.
Observed behavior
Data is missing or truncated after the script executes the sorting action, particularly in columns located far out in the spreadsheet such as CJ17:CN34.
Before you start

Ensure you have saved a secure backup copy of your original workbook before running any troubleshooting scripts to prevent accidental data loss.

Solution 1Recommended

Isolate the Issue Using a Reduced Workbook

Creating a smaller, non-sensitive sample helps determine if the missing data is caused by workbook size limits or script logic errors.

Office Scripts running on Excel for the Web are subject to data-transfer limits. When dealing with wide datasets (such as columns reaching CN), the payload size might exceed the allowed limits, resulting in partial script execution or truncated data.

1
Duplicate the file

Create a copy of your current workbook and remove all sensitive or confidential information.

2
Reduce the dataset

Delete unrelated sheets and reduce the data range, keeping only the affected columns (e.g., CJ17:CN34) and a few surrounding columns.

3
Test the script

Run your Office Script on this smaller sample workbook and compare the before and after sorting results to see if the missing data issue persists.

Isolate the Issue Using a Reduced Workbook
Data-Transfer Limits: If the script works perfectly on the reduced workbook, your original file is likely hitting Excel's online data-transfer limits. Consider running the operation in the desktop application.
Free Microsoft Office alternative

Use WPS Office for Reliable Large-Scale Data Sorting

If Microsoft Excel's data-transfer limits are causing your scripts to truncate data online, try WPS Office. It provides robust capabilities for handling large spreadsheets, excellent macro support, and full offline performance without cloud data-transfer restrictions.

  1. 1. Download WPS Office: Download and install WPS Office from the official website.
  2. 2. Open your Excel file: Open your existing .xlsx or .xlsm file directly in WPS Spreadsheet.
  3. 3. Sort the data: Select your large data range and use the built-in Sort feature or WPS JS Macros to organize your data locally without missing values.
Handle large datasets and multi-column sorting smoothly without truncation.Fully compatible with Microsoft Excel formats (.xlsx, .xlsm).Familiar user interface requires no learning curve.Supports advanced JS Macros and VBA for powerful, local automation without payload limits.
microsoft office alternative - wps office

Frequently Asked Questions

Why does my Office Script truncate data when sorting?

This usually happens due to data-transfer limits in Excel for the Web. When your workbook contains a massive number of columns or rows, the web browser struggles to process the entire payload, preventing the script from sorting the entire range correctly.

How can I sort large datasets without hitting data-transfer limits?

You can try running your sorting logic in the Excel Desktop application rather than the web version, reducing the workbook size by deleting unnecessary sheets, or using alternative desktop software like WPS Office.

What is the maximum range an Office Script can handle?

While there is no strict cell count limit, Office Scripts running online are subject to payload limits (typically around 5MB per request). Exceeding this limit by processing tens of thousands of cells at once often results in truncated data or script timeouts.