Skip to content

0.2.1

Choose a tag to compare

@github-actions github-actions released this 11 Nov 15:33
639ffa3

It uses the Rust core 0.2.1.

Changed

  • Loading no longer stops real workbooks at limits meant for hostile files.
    The old limits rejected, for example, files with more than 1,024 sheets or
    16,384 parts, 16 MiB of styles or names, or a cell over 64 KiB. The guards
    that remain stop ZIP bombs, deeply nested XML and huge XML tokens, and the
    default opens every file Excel writes.

Added

  • load_workbook(..., limits=...) takes "strict" for uploads from
    strangers, "unlimited" for files you trust, or a ResourceLimits.
    ResourceLimits.strict() and ResourceLimits.unlimited() give the presets,
    and the CRABXL_LIMITS environment variable sets the preset for code that
    cannot pass arguments, such as pandas.
  • max_expansion_ratio stops ZIP bombs: an entry larger than 1 MiB may
    expand at most 100 times.
  • crabxl.LimitExceededError, a ValueError, says which guard a file
    exceeded and how to relax it.

Fixed

  • iter_rows with all four limits no longer scans every cell of the sheet,
    and assigning a font, fill, border or alignment no longer imports the
    style module each time. Styling each appended row of a 34,000-row
    workbook took about 1.5 times as long as in openpyxl; it is now slightly
    faster than openpyxl.
  • Reading and writing cells one at a time does less work per cell. Reading
    cell.value no longer imports modules, ws.cell(row, column, value)
    writes the cell once instead of twice, and checking text for illegal
    characters no longer loops over every character in Python.
  • Reading a cell's font, fill, border, alignment or protection took about
    three times as long as in openpyxl, and creating a new Font or
    Alignment for each cell about 1.7 times. Both now take about as long as
    in openpyxl.
  • On Windows, saving a workbook over a file that a loaded workbook still had
    open failed with "access denied". It now replaces the file.