Project

PSWriteOffice

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

Stars 165
Forks 15
PowerShell Gallery downloads 158,661
Release v3.0.8
Language: C# Updated: 2026-10-12

API Reference

Cmdlet

ConvertFrom-OfficeImage

Namespace PSWriteOffice
Inputs
OfficeIMO.Pdf.Ocr.PdfSearchableOcrReview
Outputs
System.IO.FileInfo PSWriteOffice.Services.Ocr.OfficeImageConversionResult

Exports a recognized image as editable Excel, Word, text, Markdown, HTML, JSON, CSV or searchable PDF.

Remarks

Recognize once with Get-OfficeImageDocument, inspect its evidence, then reuse that snapshot for each output. Excel and CSV contain detected tables only. CSV requires exactly one table. Empty recognition or missing tables fail before output publication.

Examples

Authored help example

Export an image as Excel and Word.

PS>


$image = Get-OfficeImageDocument -Path .\Ledger.png
            $image | ConvertFrom-OfficeImage -OutputPath .\Ledger.xlsx -FirstRowIsHeader -PassThru
            $image | ConvertFrom-OfficeImage -OutputPath .\Ledger.docx
        

Excel receives caller-confirmed headers and typed columns. PassThru returns recognition evidence and the format conversion report.

Customize CSV formatting while retaining formula escaping.

PS>


$csv = @{ Delimiter = ';'; FormulaInjectionPolicy = 'Escape' }
            $image | ConvertFrom-OfficeImage -OutputPath .\Ledger.csv -CsvOptions $csv
        

Set Escape explicitly when customizing CSV formatting for spreadsheet consumption. Every recognized table row is written as data without a synthesized header, regardless of IncludeHeader.

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.

Syntax

ConvertFrom-OfficeImage [-CsvOptions <CsvSaveOptions>] [-ExcelOptions <PdfTablesToExcelOptions>] [-FirstRowIsHeader] [-Force] [-HtmlOptions <PdfToHtmlOptions>] -InputObject <PdfSearchableOcrReview> -OutputPath <String> [-PassThru] [-WordOptions <PdfToWordOptions>] [<CommonParameters>]
#
Parameter set: All Parameter Sets

Parameters

CsvOptions CsvSaveOptions optionalposition: namedpipeline: False
CSV field formatting and formula policy. When omitted, formula-like source text is escaped, including negative numeric text. Supplied options retain their FormulaInjectionPolicy; a new CsvSaveOptions object defaults to Preserve. Set Escape explicitly when customizing options for spreadsheet consumption. Every recognized table row is written as data without a synthesized header, regardless of IncludeHeader. This command controls UTF-8, uncompressed file output and replacement through Force; CsvOptions controls field formatting and formula handling.
ExcelOptions PdfTablesToExcelOptions optionalposition: namedpipeline: False
Advanced Excel typing, culture, row limit and table formatting settings.
FirstRowIsHeader SwitchParameter optionalposition: namedpipeline: False
Confirm the first row of each Excel table with unknown schema as column headers.
Force SwitchParameter optionalposition: namedpipeline: False
Replace an existing destination after conversion succeeds.
HtmlOptions PdfToHtmlOptions optionalposition: namedpipeline: False
Advanced HTML projection settings. Word and HTML defaults exclude the original scan from editable content.
InputObject PdfSearchableOcrReview requiredposition: 0pipeline: True (ByValue)
Recognized image review returned by Get-OfficeImageDocument.
OutputPath String requiredposition: 1pipeline: False
Output path. The extension selects .xlsx, .docx, .pdf, .txt, .md, .html, .json or .csv.
PassThru SwitchParameter optionalposition: namedpipeline: False
Return output location, source review and format report instead of FileInfo.
WordOptions PdfToWordOptions optionalposition: namedpipeline: False
Advanced Word projection settings.

Outputs

PSWriteOffice.Services.Ocr.OfficeImageConversionResult: Output location, recognition evidence and format projection report from an image export.