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

    Function readFile

    • Read an XLSX file from disk and return a Workbook instance. Only available in Node.js, Bun, and Deno environments. WASM must be initialized first via initWasm().

      Parameters

      • path: string

        File path to read.

      • Optionaloptions: ReadOptions

        Optional read options. Pass { password: '...' } for encrypted files and { limits: { ... } } to raise or tighten the security and size limits (see ReadLimits).

      Returns Promise<Workbook>

      A fully-parsed Workbook instance ready for reading/writing.

      ModernXlsxError with code IO_ERROR outside Node.js-compatible runtimes (browsers, workers, the IIFE build).

      import { initWasm, readFile } from 'modern-xlsx';

      await initWasm();
      const wb = await readFile('./report.xlsx');
      console.log(wb.sheetNames);