# Export-OfficeExcelGoogleSpreadsheet

Plans, compiles or exports Excel workbooks to Google Sheets.

Cmdlet 

**Module**

`PSWriteOffice`

**Inputs**

`OfficeIMO.Excel.ExcelDocument` `System.String[]`

**Outputs**

`OfficeIMO.Excel.GoogleSheets.GoogleSheetsTranslationPlan` `OfficeIMO.Excel.GoogleSheets.GoogleSheetsBatch` `OfficeIMO.Excel.GoogleSheets.GoogleSpreadsheetReference`

**Source**

[ExportOfficeExcelGoogleSpreadsheetCommand.cs:51](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/PowerShell/PSWriteOffice/Sources/PSWriteOffice/Cmdlets/Excel/ExportOfficeExcelGoogleSpreadsheetCommand.cs#L51) 

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>]
```

[#](#method-export-officeexcelgooglespreadsheet-exceldocument-switchparameter-googlesheetsexportmode-object-googleworkspacesession-switchparameter-switchparameter)

Parameter set: `Document`

```
Export-OfficeExcelGoogleSpreadsheet
[-FailOnLoss]
[-Mode <Export|Plan|Batch>]
[-Options <Object[]>]
[-Path] <String[]>
[-Session <GoogleWorkspaceSession>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
```

[#](#method-export-officeexcelgooglespreadsheet-switchparameter-googlesheetsexportmode-object-string-googleworkspacesession-switchparameter-switchparameter)

Parameter set: `Path`

```
Export-OfficeExcelGoogleSpreadsheet
[-FailOnLoss]
-LiteralPath <String[]>
[-Mode <Export|Plan|Batch>]
[-Options <Object[]>]
[-Session <GoogleWorkspaceSession>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
```

[#](#method-export-officeexcelgooglespreadsheet-switchparameter-string-googlesheetsexportmode-object-googleworkspacesession-switchparameter-switchparameter)

Parameter set: `LiteralPath`

## Guides & Samples

Authored walkthroughs and practical samples linked to this command.

- [Export and Import Google Sheets](/docs/google-workspace/sheets/) Guide
  
  Plan an Excel-to-Google-Sheets export offline, create a spreadsheet from an ExcelDocument, import a Google Sheet, and replace an existing one safely.

## Examples

### Inspect translation without signing in.

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

### Preview a Google Sheets export

```powershell
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

```powershell
$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

```powershell
$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

```powershell
$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](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters).

<!-- PowerForge markdown artifact sha256:3F07222D813F3210FB374119C5E19C64B4586DD4212A310A4426E34E03D5D6A2 -->
