Skip to content

feat(spreadsheet): import macro-enabled .xlsm workbooks - #7606

Merged
jbecke merged 1 commit into
claude/fervent-mccarthy-h6zlp1from
claude/fervent-mccarthy-h6zlp1-xlsm-import
Oct 6, 2026
Merged

jbecke merged 1 commit into
claude/fervent-mccarthy-h6zlp1from
claude/fervent-mccarthy-h6zlp1-xlsm-import

Conversation

@jbecke

@jbecke jbecke commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Stacked on #7605, which is on #7594. That PR adds the .xlsm file type and the in-sheet .xls message this PR builds on.

Macro-enabled Excel workbooks (.xlsm) now import into the sheets engine like .xlsx, with their macros removed.

Changes

  • Import instead of reject. xlsx-archive.ts rejected any package containing vbaProject.bin.
    • Imports (openXlsxArchive) now accept macro parts and add import notes:
      • "VBA macros are not imported. Cells, formulas and formatting are; the macros do not run in Macro."
      • "Excel 4.0 macro sheets are not imported."
      • "Form and ActiveX controls are not imported."
    • Macro sheets were already skipped as non-grid sheets.
    • The reader never parses [Content_Types].xml, so the macro-enabled main content type needed no change.
  • Exports stay macro-free. inspectXlsxArchive, the self-check on Macro's own .xlsx output, still refuses VBA projects, their signatures and macro sheets.
    • Download as Excel of an imported .xlsm writes a macro-free .xlsx.
    • An uploaded .xlsm keeps its macros in the original download.
  • Type gates.
    • isUploadedWorkbook now accepts xlsm, so an uploaded .xlsm opens in the read-only workbook preview and Edit in Macro imports it into a native spreadsheet. The upload query already sends non-CSV files to the Excel worker.
    • The in-sheet Import… accepts .xlsm: extension check plus accept=".xlsm,application/vnd.ms-excel.sheet.macroEnabled.12".
    • importExcel accepts .xlsx/.xlsm.
  • Docs. The agent guide describes .xlsm imports.

Testing

  • xlsm-import.test.ts (7 tests):
    • Two Excel-written .xlsm files with real VBA projects from the Apache POI test data (Apache-2.0, provenance in xlsx-fixtures/README.md). One is simple; the other has comments, embedded Word/PowerPoint objects and Cyrillic sheet names. Both import with the VBA note and export without vbaProject.
    • A Macro-written workbook repackaged as .xlsm, with the macro-enabled content type, VBA project, signature and relationship, keeps its formulas, styles and notes.
    • Macro sheets and ActiveX/form controls each get their own note.
    • Native Loro save/reopen recalculates (SUM = 6,000).
    • The export opens in ExcelJS with formulas and no macro content type.
    • The export self-check still refuses macros.
  • Updated tests: xlsx-codec.test.ts (macros now rejected only on export), csv-file.test.ts and create-workbook-actions.test.ts (.xlsm previews with its notes; .xltm/.xls still rejected), and uploaded-workbook.test.ts (.xlsm uploads use the Excel worker).
  • Browser (Playwright, real Chromium with the real import/calc workers):
    • New: import poi-simple-macro.xlsm through the file picker, see the VBA note, replace the workbook, download, and confirm no VBA parts.
    • New: an .xls shows the upload hint.
    • The full spreadsheet browser suite: 48 of 49 pass. The one failure is the collaboration test, which needs a sync-service build (services/sync-service/build/worker/shim.mjs) that doesn't exist in this environment and doesn't touch import.
  • All block-spreadsheet/block-unknown vitest suites pass (724 tests), plus tsc, biome, oxlint and ast-grep.

Generated by Claude Code

@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Repository: macro-inc/macro/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e1d3aaae-e2ee-4966-9f43-cb0eadbe9884

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

@jbecke
jbecke force-pushed the claude/fervent-mccarthy-h6zlp1-legacy-office-upgrade branch from bed8843 to 5ea2c96 Compare October 6, 2026 15:41
@jbecke
jbecke requested a review from a team as a code owner October 6, 2026 15:41
@jbecke
jbecke force-pushed the claude/fervent-mccarthy-h6zlp1-xlsm-import branch from 604187c to 735cf8a Compare October 6, 2026 15:41
@jbecke
jbecke force-pushed the claude/fervent-mccarthy-h6zlp1-legacy-office-upgrade branch from 5ea2c96 to 0cabada Compare October 6, 2026 16:16
@jbecke
jbecke force-pushed the claude/fervent-mccarthy-h6zlp1-xlsm-import branch from 735cf8a to abb68ee Compare October 6, 2026 16:22
Base automatically changed from claude/fervent-mccarthy-h6zlp1-legacy-office-upgrade to claude/fervent-mccarthy-h6zlp1 October 6, 2026 19:18
… macros

The importer accepted only .xlsx and rejected any workbook carrying a VBA
project. Macro-enabled workbooks now import like .xlsx, in the in-sheet
Import and as uploads: VBA projects, Excel 4.0 macro sheets and form or
ActiveX controls are dropped with import notes, and Download as Excel
writes a macro-free .xlsx. Macro's own exports are still checked to
carry no macro parts.

Tested with two Excel-written .xlsm files from the Apache POI test data
(Apache-2.0), synthetic macro-enabled packages, native save/reopen with
recalculation, the uploaded-workbook query and a browser test through
the real import worker.
@jbecke
jbecke force-pushed the claude/fervent-mccarthy-h6zlp1-xlsm-import branch from abb68ee to de4eff9 Compare October 6, 2026 19:19
@jbecke
jbecke merged commit 782fcb2 into claude/fervent-mccarthy-h6zlp1 Oct 6, 2026
7 checks passed
@jbecke
jbecke deleted the claude/fervent-mccarthy-h6zlp1-xlsm-import branch October 6, 2026 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants