Create and read Word, Excel, PowerPoint, Markdown, and CSV files from PowerShell.
PSWriteOffice is a PowerShell-first layer over OfficeIMO.*.
OfficeIMOowns the file-format implementation and deep document behavior.PSWriteOfficeowns the cmdlets, DSL, packaging, examples, and PowerShell ergonomics.- The module is designed to stay thin, predictable, and easy to script across Windows, Linux, and macOS.
| Area | Status | Current direction |
|---|---|---|
| Word | Mature | Document generation, HTML conversion, fields, content controls, readers |
| Excel | Advanced | Tables, ranges, formulas, charts, comments, pivots, validation, page setup |
| PowerPoint | Improving fast | Slides, placeholders, layout edits, notes, inspection helpers |
| Markdown | Solid | Parse Markdown, build Markdown with a DSL, render HTML |
| CSV | Solid | Read documents/data and export objects to CSV |
Install-Module PSWriteOffice -Scope CurrentUser
Import-Module PSWriteOfficeNew-OfficeWord -Path .\Report.docx {
WordSection {
WordHeader { WordParagraph -Text 'Quarterly Report' -Style Heading2 }
WordFooter { WordPageNumber }
WordParagraph -Text 'Hello from PSWriteOffice.'
WordList -Style Bulleted {
WordListItem -Text 'Alpha'
WordListItem -Text 'Beta'
}
}
}New-OfficeExcel -Path .\Report.xlsx {
ExcelSheet 'Data' {
ExcelCell -Address 'A1' -Value 'Name'
ExcelCell -Address 'B1' -Value 'Value'
ExcelTable -Data $Data -TableName 'ReportData' -AutoFit
ExcelValidationList -Range 'C2:C20' -Values 'New','In Progress','Done'
}
}New-OfficePowerPoint -Path .\Deck.pptx {
PptSlide {
PptTitle -Title 'Status Update'
PptTextBox -Text 'Generated with PSWriteOffice' -X 80 -Y 150 -Width 360 -Height 60
PptBullets -Bullets 'Wins','Risks','Next Steps' -X 430 -Y 150 -Width 260 -Height 200
PptNotes -Text 'Keep this under five minutes.'
}
}New-OfficeMarkdown -Path .\README.md {
MarkdownHeading -Level 1 -Text 'Report'
MarkdownParagraph -Text 'Generated by PSWriteOffice.'
MarkdownList -Items 'Alpha','Beta'
MarkdownCode -Language 'powershell' -Content 'Get-Process'
}$Data | ConvertTo-OfficeCsv -OutputPath .\export.csv
Get-OfficeCsvData -Path .\export.csvPSWriteOffice also covers read-back and inspection workflows.
Get-OfficeWordParagraph -Path .\Report.docx | Select-Object -First 5
Get-OfficeExcelNamedRange -Path .\Report.xlsx
Get-OfficeExcelPivotTable -Path .\Report.xlsx
$ppt = Get-OfficePowerPoint -FilePath .\Deck.pptx
Get-OfficePowerPointSlide -Presentation $ppt
Get-OfficePowerPointSlideSummary -Presentation $ppt
Get-OfficePowerPointNotes -Presentation $ppt
Get-OfficePowerPointShape -Presentation $ppt -Index 0
Get-OfficeMarkdown -Path .\README.md
Get-OfficeCsv -Path .\export.csvStart with the curated docs:
Useful examples:
- Examples/Word/Example-WordBasic.ps1
- Examples/Word/Example-WordAdvanced.ps1
- Examples/Excel/Example-ExcelBasic.ps1
- Examples/Excel/Example-ExcelAdvanced.ps1
- Examples/Markdown/Example-MarkdownDsl.ps1
- Examples/ExamplePowerPoint10-Dsl.ps1
- Examples/ExamplePowerPoint12-LayoutDsl.ps1
- Examples/Csv/Example-CsvAdvanced.ps1
PSWriteOffice should depend on OfficeIMO.*, not re-own lower-level library versioning unless it has a direct reason to.
OfficeIMO.WordOfficeIMO.ExcelOfficeIMO.PowerPointOfficeIMO.MarkdownOfficeIMO.CSVOfficeIMO.Word.Html
That keeps package ownership centralized and reduces version drift between the PowerShell layer and the document engine.
dotnet build .\Sources\PSWriteOffice.sln -c Debug
pwsh -NoLogo -NoProfile -File .\PSWriteOffice.Tests.ps1
pwsh -NoLogo -NoProfile -File .\Build\Validate-PackagedArtefact.ps1Build and packaging are handled through:
Build/Manage-PSWriteOffice.ps1PSPublishModule
The source tree stays development-friendly. Release artifacts are produced by the packaging pipeline.
- keep the OfficeIMO migration finished and thin
- deepen Excel and PowerPoint coverage with real round-trip tests
- add more read/inspection helpers where they improve scripting ergonomics
- keep examples and docs aligned with the real tested surface
MIT