modern-xlsx API Reference - v1.3.0
    Preparing search index...

    Interface ReadLimits

    Security and size limits for reading a workbook.

    Raise a limit only for files you trust. Every field must be a finite number greater than zero; the integer fields must also be safe integers. A value above a field's ceiling is clamped to the ceiling, not rejected.

    interface ReadLimits {
        maxCompressionRatio?: number;
        maxDecompressedSize?: number;
        maxEntries?: number;
        maxJsonLength?: number;
    }
    Index
    maxCompressionRatio?: number

    Maximum ratio of decompressed to compressed size per ZIP entry (unitless). Default: 100. No ceiling. A sheet padded with whitespace can compress past 100:1.

    maxDecompressedSize?: number

    Maximum total decompressed size of all ZIP entries, in bytes. Default and ceiling: 2,147,483,648 (2 GiB).

    maxEntries?: number

    Maximum number of ZIP entries. Default: 100,000. Ceiling: 1,048,576.

    maxJsonLength?: number

    Maximum length of the JSON the reader builds for the workbook, in UTF-8 bytes. Default and ceiling: 536,870,888 (V8's maximum string length). UTF-8 bytes are an upper bound on UTF-16 units, so a workbook with non-ASCII text can be rejected slightly before V8's own limit. Exceeding it rejects with code SIZE_LIMIT. It also bounds the total text a read copies from shared strings, comment authors, hyperlink targets and worksheet namespace declarations into the cells, comments, hyperlinks and kept worksheet extensions that name them: the read rejects with SIZE_LIMIT as soon as those copies pass it. It also bounds the memory of the records a read keeps in its lists (the defined names, the shared string entries and rich text runs, the fonts, fills, borders, cell and differential formats and other records of xl/styles.xml, the chart series and axes, the threaded comments and mentions, then the worksheet lists: data validations, conditional-format rules, selections, columns, hyperlinks, merged ranges and the like), counted together over all of them and all sheets at each record's size in memory: a part of millions of tiny records rejects with SIZE_LIMIT before its JSON is built, and a workbook whose JSON fits can be refused for it (in the npm build, measured on 2026-11-13, 1,000,000 one-rule conditional formats use about 55% of the default).