Workbook Lifecycle¶
Use the workbook tool or CLI command group for workbook-level metadata, file variants, publishing, and external links. Use file only for opening, creating, listing, and closing sessions.
Metadata and document properties¶
get-inforeturns the active workbook name, path, Excel file format, saved/read-only state, and password/write-reservation flags.list-document-propertiescan include built-in properties, custom properties, or both.get-document-propertyandset-document-propertyrequirescope:built-inorcustom.- Built-in properties can be read and updated but not deleted.
- Missing custom properties are created as string properties by
set-document-property;delete-document-propertyremoves custom properties only.
Save and publish¶
save-assupportsauto,xlsx,xlsm,xlsb, andxls. The file extension must match the selected format, and the active session follows the new path.save-copy-aspreserves the current format and leaves the active workbook/session unchanged. Its target extension must match the active workbook.export-fixed-formatpublishes PDF or XPS. Keepopen_after_publish=falsefor unattended workflows.- Output directories must already exist. Existing files require
overwrite=true.
Changing formats can remove unsupported workbook features. In particular, saving a macro-enabled workbook as .xlsx removes VBA content after Excel's format conversion.
External Excel links¶
- Call
list-external-linksand use the exact returnedsource. - Call
update-external-linkto refresh one source. - Call
break-external-linkonly with explicit user intent: it permanently replaces linked formulas with their current values.
Printing and print preview are not exposed. Printing can send output to a physical default printer, and preview is modal and can block unattended Excel sessions.