Writes a multi-sheet xlsx workbook from a JSON spec.
Named-mode only: pass a single JSON object. Sheets, rows, cells, formulas, formats, dates, hyperlinks, and charts are encoded inline in the spec. The result is written to a path, returned as a FileMaker container, or both.
Declaration
Inlay_EXCEL_EXPORT ( JSONSetElement ( "{}" ;
[ "OutputPath" ; "/Users/alice/Reports/Q1.xlsx" ; JSONString ] ;
[ "Sheets" ; "[{\"name\":\"Summary\",\"rows\":[[\"Item\",\"Total\"]]}]" ; JSONString ]
) )
Parameters
- Sheets Required
- an array of sheet objects. Each sheet has name, optional freeze, autofilter, columns, rows (arrays of cells), and charts. A cell is a scalar, or an object form for formatted scalars, formulas, dates, or hyperlinks.
- OutputPath Optional
- destination file path. When omitted, the workbook is returned as a container. Accepts a POSIX path, a bare HFS path (Macintosh HD:Users:...), filemac:/, filewin:/, or file:/.
- Filename Optional
- file name used in container mode. Default Export.xlsx; an .xlsx extension is added if missing.
- AsContainer Optional
- 1/true/yes or 0/false/no. When true together with OutputPath, returns both the written file and a container.
- Password Optional
- when non-empty, wraps the workbook in MS-OFFCRYPTO agile encryption (AES-256, SHA-512) so Excel prompts for this password on open.
Returns
JSON string In path mode returns {"ok":true,"path":...,"bytes":N,"sheets":N}. In container or hybrid mode the result field is set to the workbook bytes as a FileMaker container. On error returns {"ok":false,"message":"..."}.
Use Cases
- Generate a formatted multi-sheet report with charts from found-set data in one call.
- Produce a password-protected workbook for distribution outside FileMaker.
Notes
- Any structural slot (sheets, rows, columns, autofilter, freeze, charts, series) accepts a real JSON value or a string-encoded JSON value, so JSONSetElement chains with JSONString work.
- Cell forms: scalar; {value, format?}; {formula, value?, format?}; {date, format?} with ISO-8601 dates; {link, text?, format?} where link is https, http, mailto, internal:Sheet!Cell, or an external file path.
- Formats accept named tokens (bold, italic, header, int, decimal2, usd, percent, date, datetime), a raw Excel format code, or an object with bold, italic, fonts, colors, borders, alignment, and numberFormat.
- Charts support column, line, bar, pie, scatter, and area with series ranges, axis names, and legend placement.
- Legacy camelCase keys outputPath, filename, asContainer, password, and sheets are accepted.