Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

Export-OfficeExcelGoogleSpreadsheet

Module
PSWriteOffice
Inputs
OfficeIMO.Excel.ExcelDocument System.String[]
Outputs
OfficeIMO.Excel.GoogleSheets.GoogleSheetsTranslationPlan OfficeIMO.Excel.GoogleSheets.GoogleSheetsBatch OfficeIMO.Excel.GoogleSheets.GoogleSpreadsheetReference

Plans, compiles or exports Excel workbooks to Google Sheets.

Syntax

Export-OfficeExcelGoogleSpreadsheet
[-Document <ExcelDocument>]
[-FailOnLoss]
[-Mode <Export|Plan|Batch>]
[-Options <Object[]>]
[-Session <GoogleWorkspaceSession>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
#
Parameter set: Document
Export-OfficeExcelGoogleSpreadsheet
[-FailOnLoss]
[-Mode <Export|Plan|Batch>]
[-Options <Object[]>]
[-Path] <String[]>
[-Session <GoogleWorkspaceSession>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
#
Parameter set: Path
Export-OfficeExcelGoogleSpreadsheet
[-FailOnLoss]
-LiteralPath <String[]>
[-Mode <Export|Plan|Batch>]
[-Options <Object[]>]
[-Session <GoogleWorkspaceSession>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
#
Parameter set: LiteralPath

Examples

Inspect translation without signing in.

Export-OfficeExcelGoogleSpreadsheet -Path .\Report.xlsx -Mode Plan

Preview a Google Sheets export

Export-OfficeExcelGoogleSpreadsheet -Path .\Reports\Q3-Sales.xlsx -Mode Plan

Returns the translation plan, including anything Google Sheets cannot represent, without contacting Google.

Publish a workbook to Google Sheets

$googleSession = New-OfficeGoogleWorkspaceSession -KeyPath .\Secrets\reporting-sa.json -Scope Spreadsheets, DriveFile
Export-OfficeExcelGoogleSpreadsheet -Path .\Reports\Q3-Sales.xlsx -Session $googleSession -FailOnLoss

Uploads the sales workbook through an authenticated Google Workspace session and stops if any content would be lost.

Build the request batch for your own client

$book = Open-OfficeExcel -Path .\Reports\Q3-Sales.xlsx -ReadOnly
$batch = Export-OfficeExcelGoogleSpreadsheet -Document $book -Mode Batch
Close-OfficeExcel -Document $book

Returns the provider-neutral request batch for an open workbook, for an integration that sends the requests itself.

Replace an existing spreadsheet in a shared folder

$googleSession = New-OfficeGoogleWorkspaceSession -KeyPath .\Secrets\reporting-sa.json -Scope Spreadsheets, DriveFile
$google = New-OfficeExcelGoogleSheetsOptions -Title 'Q3 sales' -FolderId $folderId -SpreadsheetId $spreadsheetId -UnsupportedFormula UseCachedValue
Export-OfficeExcelGoogleSpreadsheet -Path .\Reports\Q3-Sales.xlsx -Session $googleSession -Options $google

Exports the workbook over an existing Google spreadsheet with a fixed title and preserved unsupported formulas.

Parameters

-Document ExcelDocument optionalpipeline: True (ByValue)sets: Document
Caller-owned document; omission uses the enclosing content block.
-FailOnLoss SwitchParameter optional
Reject translation warnings or errors before returning a result or mutating Google.
-Mode GoogleSheetsExportMode optional
Export by default, or return an offline Plan or Batch.
Possible values: Export, Plan, Batch
-Options Object[] optional
One native options object and property hashtables applied to an independent snapshot.
-Session GoogleWorkspaceSession optional
Configured Google Workspace session, required for Export mode.
-WhatIf SwitchParameter optional
Shows what would happen if the command runs.
-Confirm SwitchParameter optional
Prompts for confirmation before running the command.
-Path String[] requiredposition: 0pipeline: True (ByValue)sets: Path
Source document paths, including filesystem wildcard patterns.
-LiteralPath String[] requiredpipeline: True (ByPropertyName)aliases: FullName, PSPathsets: LiteralPath
Literal source paths; FileInfo.FullName and provider PSPath bind here.

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.