Cmdlet
Set-OfficeExcelRefreshOnOpen
Turns refresh-on-open on or off for pivot caches and connections.
Syntax
Set-OfficeExcelRefreshOnOpen
[-Connections]
[-Disable]
[-Document <ExcelDocument>]
[-PassThru]
[-PivotTables]
[-SavePivotSourceData]
[<CommonParameters>]#Parameter set:
DefaultExamples
Refresh pivot tables on open
Open-OfficeExcel -Path .\Reports\Sales-2026.xlsx {
ExcelRefreshOnOpen -PivotTables
}Makes Excel refresh every pivot cache when the workbook opens.
Stop refreshing before archiving
Open-OfficeExcel -Path .\Archive\Sales-2026-09.xlsx {
ExcelRefreshOnOpen -PivotTables -Connections -Disable -PassThru
}Turns off refresh-on-open for pivot tables and connections in a month-end copy, so the archived figures stay as they were.
Parameters
- -Connections SwitchParameter
- Update workbook connection refresh-on-open metadata.
- -Disable SwitchParameter
- Disable refresh-on-open instead of enabling it.
- -Document ExcelDocument
- Caller-owned workbook; omission uses the enclosing Excel content block.
- -PassThru SwitchParameter
- Emits the native result after the operation.
- -PivotTables SwitchParameter
- Update pivot cache refresh-on-open metadata.
- -SavePivotSourceData SwitchParameter
- Preserve pivot cache source data.
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.