Skip to content

pyflightstream.workspace.excel (stable)

Generated from the docstrings at build time: every one of the 5 names in the __all__ of pyflightstream.workspace.excel has an entry below. The names a guide or an example uses come first; the others follow under Advanced.

Create the optional workbook without launching Excel or changing trust settings.

Used in the guides

pyflightstream.workspace.excel.main

main(argv: list[str] | None = None) -> int

Create or explicitly synchronize a saved macro-free workbook.

The module form, kept as the alias of pyfs-workspace excel.

Parameters:

Name Type Description Default
argv list of str

The command-line arguments, sys.argv[1:] by default.

None

Returns:

Type Description
int

0 on success, 1 when an apply reports a partial write, 2 when the command was not completed.

Advanced

pyflightstream.workspace.excel.EXCEL_ACTION module-attribute

EXCEL_ACTION = 'excel_command'

pyflightstream.workspace.excel.add_excel_actions

add_excel_actions(parser: ArgumentParser) -> None

Add the workbook actions to parser: create, preview, apply, cancel and check.

The one definition of the workbook command line, read by pyfs-workspace excel and by python -m pyflightstream.workspace.excel, its alias. --workspace defaults to the current directory, as in every other workspace command.

Parameters:

Name Type Description Default
parser ArgumentParser

The parser that receives the actions as its subcommands.

required

pyflightstream.workspace.excel.create_workbook

create_workbook(
    path: str | Path, *, workspace: str | Path
) -> Path

Create a new macro-free .xlsx; synchronize saved files through the CLI.

Parameters:

Name Type Description Default
path str or Path

The new .xlsx file; an existing file is refused.

required
workspace str or Path

The workspace the workbook synchronizes with.

required

Returns:

Type Description
Path

The created workbook, resolved.

Raises:

Type Description
ExcelSyncError

If the path is not a new .xlsx file.

MissingExtraError

If XlsxWriter, of the excel extra, is not installed.

pyflightstream.workspace.excel.run_excel_action

run_excel_action(args: Namespace) -> int

Run the workbook action a parser of :func:add_excel_actions read.

Parameters:

Name Type Description Default
args Namespace

The parsed command line.

required

Returns:

Type Description
int

0 on success, 1 when an apply reports a partial write, 2 when the command was not completed.