Skip to main content

PowerShell document automation

PSWriteOffice

Automate Word, Excel, PowerPoint, PDF, Reader, Visio, Markdown, CSV, RTF, OpenDocument, email, AsciiDoc, and LaTeX workflows from PowerShell.

MIT licensed No Office required PowerShell 5.1 and 7+
Install Install-Module PSWriteOffice
Generated output · PSWriteOffice
GENERATED OUTPUT

Ready for your workflow

Build, inspect, and transform documents through a focused API.

PowerShell
New-OfficeWord -Path '.\report.docx' {
    Add-OfficeWordSection {
        Add-OfficeWordParagraph `
            -Text 'Quarterly report' `
            -Style Heading1
    }
}

Why PSWriteOffice?

PSWriteOffice brings the OfficeIMO document stack to PowerShell. The command surface shown here is generated from the current module manifest used for this release. Create, inspect, update, review, convert, secure, and deliver documents from scripts and automation jobs without maintaining a separate document engine.

Features

  • Manifest-derived command catalog — cmdlets, aliases, and families are counted from the current module manifest
  • DSL aliases — intuitive shorthand like WordParagraph, ExcelSheet, and PptSlide for concise scripts
  • Broad document platform — Word, Excel, PowerPoint, PDF, Reader, Visio, Markdown, CSV, RTF, OpenDocument, email, AsciiDoc, LaTeX, and HTML asset workflows
  • Cross-platform — PowerShell 7+ runs on Windows, Linux, and macOS
  • PowerShell 5.1 and 7+ — supports Windows PowerShell 5.1 on Windows and modern PowerShell across platforms

Command families

The current module exports 478 cmdlets and 361 aliases across 16 documentation families. Cross-format commands have one documentation owner, so the family totals match the manifest.

FamilyCmdletsTypical work
Word91Create, inspect, update, review, merge, protect, and convert DOC and DOCX documents.
Excel155Build, read, convert, validate, repair, compare, and publish XLS and XLSX workbook workflows.
PowerPoint57Compose, inspect, update, import, theme, and render repeatable presentation decks.
PDF80Author, inspect, transform, sign, annotate, extract, preflight, and combine PDF files.
Reader and extraction13Detect formats and extract normalized documents, chunks, tables, visuals, assets, and ingest results.
Confluence Cloud7Plan and publish pages, preserve managed sections, and transfer attachments through OfficeIMO.Confluence.
Visio21Create, inspect, arrange, and export VSDX diagrams with built-in and imported stencils.
Markdown25Compose typed Markdown, parse documents, and convert between Markdown and HTML or Word.
RTF5Create, open, edit, inspect, and bridge Rich Text Format documents.
CSV5Create, import, inspect, and export delimited data with typed options.
OpenDocument5Create, read, and save ODT, ODS, and ODP workflows.
Email4Read and write messages and mailbox artifacts through the managed OfficeIMO.Email engine.
AsciiDoc4Read, create, update, and save bounded AsciiDoc workflows.
LaTeX4Read, create, update, and save bounded LaTeX interoperability workflows.
HTML assets1Export images and review surfaces used by document-to-HTML workflows.
Shared authoring primitives1Create reusable text runs shared by document DSLs.

Browse the generated family guide or search the PowerShell API reference for parameter-level detail.

Start from a real workflow

JobWorking path
Export SQL data to Excel and verify the round tripDbaClientX database reporting guide and the runnable Excel example
Move database data through CSVRunnable CSV round-trip example
Create an operational Excel dashboardExcel showcase example
Build a PowerPoint service briefPowerPoint showcase example
Browse copyable PowerShell patternsPSWriteOffice recipe gallery
Compare Excel and CSV performancePSWriteOffice benchmark guide
Evaluate mixed search, authenticated PDF, or Confluence publishingPSWriteOffice command families

Quick start

# Install the module
Install-Module PSWriteOffice -Force

# Create a Word document
New-OfficeWord -Path ".\Report.docx" {
    Add-OfficeWordSection {
        Add-OfficeWordParagraph -Style Heading1 -Text "Monthly Report"
        Add-OfficeWordParagraph -Text "Generated on $(Get-Date -Format 'MMMM yyyy')"

        $data = @(
            [pscustomobject]@{ Region = "North"; Revenue = 42000; Target = 40000 }
            [pscustomobject]@{ Region = "South"; Revenue = 38000; Target = 35000 }
            [pscustomobject]@{ Region = "East";  Revenue = 29000; Target = 30000 }
            [pscustomobject]@{ Region = "West";  Revenue = 51000; Target = 45000 }
        )

        Add-OfficeWordTable -InputObject $data -Style GridTable4Accent1
        Add-OfficeWordParagraph {
            Add-OfficeWordText -Text "All regions met or exceeded targets except East."
        }
    }
}

# Create an Excel workbook
New-OfficeExcel -Path ".\Metrics.xlsx" {
    Add-OfficeExcelSheet -Name "Summary" {
        Set-OfficeExcelCell -Address "A1" -Value "Metric"
        Set-OfficeExcelCell -Address "B1" -Value "Value"
        Set-OfficeExcelCell -Address "C1" -Value "Status"
        Set-OfficeExcelCell -Address "A2" -Value "Uptime"
        Set-OfficeExcelCell -Address "B2" -Value "99.97%"
        Set-OfficeExcelCell -Address "C2" -Value "OK"
        Set-OfficeExcelCell -Address "A3" -Value "Response Time"
        Set-OfficeExcelCell -Address "B3" -Value "42ms"
        Set-OfficeExcelCell -Address "C3" -Value "OK"
    }

    Add-OfficeExcelSheet -Name "Details" {
        Set-OfficeExcelCell -Address "A1" -Value "Timestamp"
        Set-OfficeExcelCell -Address "B1" -Value "Endpoint"
        Set-OfficeExcelCell -Address "C1" -Value "Latency"
        $rowIndex = 2
        1..10 | ForEach-Object {
            Set-OfficeExcelCell -Row $rowIndex -Column 1 -Value ((Get-Date).AddMinutes(-$_))
            Set-OfficeExcelCell -Row $rowIndex -Column 2 -Value "/api/data"
            Set-OfficeExcelCell -Row $rowIndex -Column 3 -Value (Get-Random -Minimum 20 -Maximum 80)
            $rowIndex++
        }
    }
}

# Create a PowerPoint presentation
$ppt = New-OfficePowerPoint -FilePath ".\Status.pptx"
$slide = Add-OfficePowerPointSlide -Presentation $ppt
Add-OfficePowerPointTextBox -Slide $slide -Text "Weekly Status" -X 80 -Y 60 -Width 520 -Height 50
Add-OfficePowerPointBullets -Slide $slide -Bullets @(
    "Shipped v3.2 to production",
    "Resolved 14 customer tickets",
    "Completed security audit"
) -X 80 -Y 150 -Width 520 -Height 220
$ppt | Save-OfficePowerPoint

Compatibility

PlatformPowerShell VersionSupported
Windows5.1Yes
Windows7+Yes
Linux7+Yes
macOS7+Yes

PSWriteOffice is available from the PowerShell Gallery and includes generated help for its cmdlet surface.

GuideDescription
PSWriteOffice overviewStart with installation, command families, and module scope.
PowerPoint cmdletsBuild generated decks with slides, bullets, tables, and images.
Markdown cmdletsGenerate Markdown reports and repository-friendly docs from scripts.
Database reportingConnect DbaClientX queries and bulk writes to Excel and CSV artifacts.
Performance evidenceReproduce the PowerForge-backed Excel and CSV comparisons.
OfficeIMO roadmapSee open cross-package work without mixing it into current command documentation.
PowerShell API referenceBrowse the full cmdlet surface with parameters and examples.
PackageDescription
OfficeIMO.Word.NET library powering Word document creation
OfficeIMO.Excel.NET library powering Excel workbook creation
OfficeIMO.PowerPoint.NET library powering PowerPoint presentation creation

Next step

Turn the package into a working document.

Follow a focused guide, inspect the generated API reference, or try a browser-safe conversion.