Open or Create Spreadsheet
Command description
- If the specified spreadsheet file already exists, the command opens it without recreating, deleting, or clearing it.
- By default, openpyxl reads and writes
.xlsxfiles directly without launching Microsoft Office or WPS Office. - Office and WPS modes use a COM interface. The Visibility parameter controls whether the application window is shown.
- After reading or writing data, use Close Spreadsheet to release resources. To access the spreadsheet again after closing it, reopen it with Open or Create Spreadsheet.
Command Input Parameters
| input parameters | Input parameter type | Description |
|---|---|---|
| Application | enum | openpyxl, WPS, Office; openpyxl reads and writes .xlsx files directly, while WPS and Office use a COM interface |
| Visibility | enum | Hide, Show; applies only when WPS or Office is selected |
| File Location | str | Spreadsheet path, such as C:\files\report.xlsx; a relative path is resolved under the current user's Documents\RPA directory |
Command Output Parameters
| Output parameters | Output parameter type | Description |
|---|---|---|
| Excel Object | ExcelApp | The opened spreadsheet object; use its path attribute to get the full file path |
tip
openpyxl mode does not require Microsoft Office or WPS Office. It supports .xlsx and attempts to preserve macros in existing .xlsm files. If the path has no extension, .xlsx is added automatically. The older .xls format is not supported, and formula results are not recalculated. Select Office or WPS when exact display formatting, formula recalculation, or .xls compatibility is required.
Example
Read each cell in sequence