Project

PSWriteOffice

PowerShell document automation across Word, Excel, PowerPoint, PDF, Reader, Confluence, Visio, and open text formats.

Stars159
Forks14
Open issues0
PowerShell Gallery downloads158661
Releasev3.0.5
Language: C# Updated: 2026-09-03T07:09:53.0000000+00:00

Documentation

Reliable Automation Patterns

Structure document jobs for repeatability, diagnostics, safe mutation, and CI artifacts. Includes examples and cmdlet links.

Document automation becomes easier to operate when scripts separate source data, document composition, validation, and delivery.

Start with the smallest public surface

Use a pipeline for a direct export, a live document object for loop-driven composition, the DSL for a complete authored artifact, and targeted commands for an existing file. Escalating only when the job needs more structure keeps common scripts short without hiding advanced capabilities. See pipeline, object, and DSL workflows.

Keep paths and data explicit

Resolve input and output roots once. Pass plain objects into document builders instead of reading global state from nested DSL blocks. Write validation output beside the artifact or into a CI report folder.

Prefer canonical commands in reusable scripts

PSWriteOffice publishes aliases for a compact DSL, but canonical commands make long-lived scripts easier to search, document, and compare with generated help. Use aliases when they materially improve a local composition block; keep entry points and operational steps canonical.

Inspect before mutation

For existing files, collect preflight, capability, signature, compliance, accessibility, or format-detection evidence before changing the document. Write to a new path during development and reopen the result through the same engine.

Treat conversion as a result

Keep the source, destination, diagnostics, warnings, and any fidelity policy together. A successful file write does not by itself prove that complex layout or unsupported features were preserved.

Make jobs idempotent

Create a fresh output folder or use stable file names with deliberate overwrite behavior. Avoid appending the same section, sheet, or slide on every rerun unless the script first detects whether it already exists.

For object workflows, create with -NoSave, apply the complete change set, then use the matching Save-* and Close-* commands once. Saved DSL constructors are quiet by default; use -PassThru only when another command needs the saved file.

Bound batch work

For Reader and conversion batches, limit concurrency based on document size and native-memory pressure. Capture failures per file so one malformed input does not erase evidence for the rest of the batch.

Use the generated surface

The command reference is the authoritative parameter contract. The examples demonstrate complete job shapes. Pin the module version in production automation and review release notes before changing that pin.