XLS Row and Column Limits: What Happens to Oversized Workbooks

November 08, 2026 · XLS.now Editorial · XLS Troubleshooting

Explain BIFF limits, truncation risk, compatibility mode and safe migration validation.

BIFF8 Structural Limits: Why 65,536 Rows and 256 Columns Are Fixed

The XLS file format implements the Binary Interchange File Format version 8 (BIFF8), documented in the Microsoft Open Specification for Office File Formats [MS-XLS]. The specification defines a worksheet’s addressable space through two record-level constraints: a 16-bit unsigned integer for row indexes (0 through 65,535) and an 8-bit unsigned integer for column indexes (0 through 255). These widths are not configurable. They are embedded in the Rw field of the Row record (section 2.4.55) and the col field of the ColInfo record (section 2.4.50). Any cell address outside this range cannot be represented in a valid BIFF8 stream. A file that contains a row index of 65,536 or a column index of 256 violates the record structure and is malformed by definition.

The practical consequence: a single BIFF8 worksheet cannot exceed 65,536 rows or 256 columns. This applies regardless of the application that writes the file. Excel, LibreOffice, and third-party libraries all operate within the same binary constraints when producing XLS output.

How Truncation Occurs During Save Operations

When an application saves a workbook that exceeds BIFF8 dimensions to XLS format, the most common behavior is silent truncation. The saving routine iterates over the in-memory grid and writes only the cells that fall within the valid row and column ranges. Rows numbered 65,537 and above are omitted from the output stream. Columns beyond column IV (column index 256) are similarly excluded. No placeholder records, error values, or warning markers are written in their place.

This truncation is irreversible from the XLS file alone. The omitted data never enters the binary stream, so no recovery tool can extract it. The resulting file is structurally valid according to the BIFF8 specification, which means validation tools will not flag it as corrupt. The only evidence of data loss is the discrepancy between the original dataset’s dimensions and the saved file’s dimensions.

Structure Corruption: When Invalid Indexes Are Written

A separate failure mode occurs when a tool writes cell records with out-of-range row or column indexes. This can happen with poorly implemented exporters, legacy software that predates the specification’s clarification, or manual binary manipulation. The BIFF8 record structure uses fixed-width fields for row and column indexes within RK, Number, LabelSst, and Formula cell records (sections 2.4.75 through 2.4.78). If a writer places a value larger than 65,535 in a row field, the record no longer conforms to the expected layout. Downstream parsers may misinterpret subsequent bytes, misalign record boundaries, or encounter buffer overruns.

Symptoms of structure corruption include: - “File format is not valid” errors when opening in Excel. - Application crashes during load, particularly in older Excel versions. - Partial worksheet rendering where visible rows stop abruptly at an unexpected offset. - #REF! errors in formulas that reference cells the parser could not resolve.

Repair is sometimes possible by hex-editing the offending record indexes back into range, but this requires identifying the exact byte offset of the violation. In most cases, returning to the pre-export source data is the only reliable recovery path.

Compatibility Mode Warnings and Their Limitations

Excel’s Compatibility Mode, introduced in Excel 2007, displays a dialog when saving a workbook as XLS that contains content exceeding BIFF8 limits. The warning messages are specific:

  • “This workbook contains data in cells outside of the row and column limit of the selected file format. Data beyond 65,536 rows and 256 columns will not be saved.”
  • “Formulas referencing data in unsaved regions will be affected and may return #REF! errors.”

The dialog presents “Continue” and “Cancel” options. Selecting “Continue” executes the truncation described above. The application does not offer a partial save, a split-sheet option, or an automatic downsampling. The warning is informational, not protective. It does not list which rows or columns will be removed, nor does it log the affected cell references. If the user clicks “Continue” without independently verifying the dataset’s dimensions, data loss is confirmed at that moment.

The only safe response to this dialog is “Cancel,” followed by saving the workbook in a format without these dimensional constraints, such as XLSX or CSV.

Diagnosing an XLS File for Dimensional Risk

Before opening or converting an XLS file, verify its row and column counts against the BIFF8 limits. Three methods provide increasing levels of certainty.

Manual Inspection in a Spreadsheet Application

Open the file in Excel or LibreOffice Calc. Press Ctrl+End to navigate to the last cell that contains data or formatting. The Name Box displays the cell reference. If the row number is 65,536 and the column letter is IV, the worksheet is at the BIFF8 boundary. If the file was originally larger, truncation has already occurred. Note that Ctrl+End can be misleading if the worksheet contains formatting in empty cells; use this as a preliminary check, not a definitive count.

Programmatic Row and Column Count

Use a library that parses BIFF8 records directly. The Python xlrd library (version 1.2.0, the last release supporting XLS) reads the DIMENSION record (section 2.4.76) to report the used range:

python -c "import xlrd; wb = xlrd.open_workbook('file.xls'); sh = wb.sheet_by_index(0); print(f'Rows: {sh.nrows}, Cols: {sh.ncols}')"

If nrows equals 65,536 or ncols equals 256, the file may have been truncated. Values exceeding these limits indicate a malformed file that xlrd may refuse to parse, raising an XLRDError.

Binary Record Inspection

For definitive validation, examine the raw BIFF8 records. The DIMENSION record (record type 0x0200) specifies the first and last row and column indexes used in the sheet. A hex dump showing a maximum row index of 0xFFFF (65,535) and maximum column index of 0xFF (255) confirms the sheet occupies the full addressable space. The Row records (record type 0x0208) contain the row index in bytes 0-1. Any value above 0xFFFF in a row index field is a structural violation. Tools such as biffdump (part of the libgsf package) or a general hex editor with BIFF8 record templates can surface these values.

What Conversion to XLSX or CSV Can and Cannot Recover

If an XLS file is at risk or already truncated, conversion to a modern format is the standard remediation step. The outcome depends on what the XLS file actually contains.

Conversion to XLSX

XLSX format uses Office Open XML and supports 1,048,576 rows by 16,384 columns. Converting a valid, non-truncated XLS file to XLSX preserves all data within the 65,536 × 256 range, along with cell formatting, formulas, defined names, and sheet structure. Data that was truncated during the original XLS save is absent from the binary stream and cannot be recovered by conversion. The XLSX file will contain exactly the rows and columns present in the XLS source.

Conversion to CSV

CSV conversion extracts cell values as plain text. Formulas are replaced with their last calculated values. Formatting, multiple sheets, charts, and VBA macros are discarded. CSV has no inherent row or column limit, so it can accommodate the full contents of the XLS file. This makes CSV a useful intermediate format for re-importing data into a database or a new workbook, provided the loss of structure is acceptable.

Unrecoverable Data

Three categories of data loss are permanent once an XLS file is written: - Truncated rows and columns: Data beyond the BIFF8 boundaries was never stored. Only the original data source can supply it. - Corrupted records: If the file contains out-of-range indexes, converters may skip the affected records, halt with an error, or produce garbled output. No converter can interpret a structurally invalid record. - VBA macros referencing truncated ranges: Macros stored in the XLS file may contain hardcoded references to cells that no longer exist. Conversion to XLSX may preserve the VBA code if saved as XLSM, but the references will still be broken. Testing macro functionality after conversion is mandatory.

Validating a Migration with a Three-Way Row and Column Count

A reliable migration requires comparing row and column counts across three data states. Execute these steps in order:

  1. Count the original source data. If the XLS file was exported from a database, query COUNT(*) and the column count of the source table. If it originated from a CSV or XLSX file, open that file and note the exact row and column dimensions.
  2. Count the XLS file. Use the programmatic method described above to read nrows and ncols from each sheet. Record these values.
  3. Count the converted output. After converting to XLSX or CSV, count the rows and columns in the resulting file using the same programmatic approach or a reliable spreadsheet application.

If the counts from step 2 and step 3 match, and both are less than or equal to the source count from step 1, the migration is clean. If step 2 or step 3 shows fewer rows or columns than step 1, data was lost during the original XLS save or during conversion. Do not assume the converter compensated for BIFF8 limits. Most converters read only what the XLS file contains. The discrepancy must be resolved by returning to the original source, not by reprocessing the truncated XLS file.

For ongoing work with legacy systems that require XLS format, enforce a worksheet limit of 65,000 rows and 250 columns. This margin prevents accidental boundary hits from application-specific edge cases, such as hidden rows or formatted empty cells that extend the used range. Use XLSX or CSV for any dataset that may grow beyond these thresholds.