RPA.Excel.Application
Add new worksheet to workbook. Workbook is created by default if it does not exist.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
sheetname | str | null | name for sheet |
create_workbook | bool | True | create workbook if True, defaults to True |
param sheetname: | |
---|---|
name for sheet | |
param create_workbook: | |
create workbook if True, defaults to True | |
raises ValueError: | |
error is raised if workbook does not exist and create_workbook is False |
Adds new workbook for Excel application
Close the active document and app (if open).
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
save_changes | bool | False | Enable changes saving on quit. (False by default) |
param save_changes: | |
---|---|
Enable changes saving on quit. (False by default) |
Export Excel as PDF file
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
pdf_filename | str | null | PDF filename to save |
excel_filename | str, None | None | Excel filename to open |
If Excel filename is not given, the currently open workbook will be exported as PDF.
param pdf_filename: | |
---|---|
PDF filename to save | |
param excel_filename: | |
Excel filename to open |
Find first available free cell
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
worksheet | Any | None | worksheet to handle, defaults to active worksheet if None |
row | int | 1 | starting row for search, defaults to 1 |
column | int | 1 | starting column for search, defaults to 1 |
param worksheet: | |
---|---|
worksheet to handle, defaults to active worksheet if None | |
param row: | starting row for search, defaults to 1 |
param column: | starting column for search, defaults to 1 |
return: | tuple (row, column) or (None, None) if not found |
Find first available free row
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
worksheet | Any, None | None | worksheet to handle, defaults to active worksheet if None |
row | int | 1 | starting row for search, defaults to 1 |
column | int | 1 | starting column for search, defaults to 1 |
param worksheet: | |
---|---|
worksheet to handle, defaults to active worksheet if None | |
param row: | starting row for search, defaults to 1 |
param column: | starting column for search, defaults to 1 |
return: | row or None |
Open the application.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
visible | bool | False | Show the window on opening. (False by default) |
display_alerts | bool | False | Display alert popups. (False by default) |
param visible: | Show the window on opening. (False by default) |
---|---|
param display_alerts: | |
Display alert popups. (False by default) |
Open Excel by filename
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
filename | str | null | path to filename |
By default sets active worksheet to sheet number 1
param filename: | path to filename |
---|
Quit the application.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
save_changes | bool | False | Enable to save changes on quit. (False by default) |
param save_changes: | |
---|---|
Enable to save changes on quit. (False by default) |
Read value from cell.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
worksheet | Any | None | worksheet to handle, defaults to active worksheet if None |
row | int | None | target row, defaults to None |
column | int | None | target row, defaults to None |
param worksheet: | |
---|---|
worksheet to handle, defaults to active worksheet if None | |
param row: | target row, defaults to None |
param column: | target row, defaults to None |
raises ValueError: | |
if cell is not given |
Run Excel macro with given name
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
macro_name | str | null | macro to run |
args | Any | null | arguments to pass to macro |
param macro_name: | |
---|---|
macro to run | |
param args: | arguments to pass to macro |
Saves Excel file
Save Excel with name if workbook is open
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
filename | str | null | where to save file |
autofit | bool | False | autofit cell widths if True, defaults to False |
file_format | None | format of file |
param filename: | where to save file |
---|---|
param autofit: | autofit cell widths if True, defaults to False |
param file_format: | |
format of file |
Note: Changing the file extension for the path does not affect the actual format. To use an older format, use the file_format argument with one of the following values:
https://docs.microsoft.com/en-us/office/vba/api/excel.xlfileformat
Examples:
Set active worksheet by either its sheet number or name
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
sheetname | str | None | name of Excel sheet, defaults to None |
sheetnumber | int | None | index of Excel sheet, defaults to None |
param sheetname: | |
---|---|
name of Excel sheet, defaults to None | |
param sheetnumber: | |
index of Excel sheet, defaults to None |
Write value, number_format and/or formula into cell.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
worksheet | Any | None | worksheet to handle, defaults to active worksheet if None |
row | int | None | target row, defaults to None |
column | int | None | target row, defaults to None |
value | str | None | possible value to set, defaults to None |
number_format | str | None | possible number format to set, defaults to None |
formula | str | None | possible format to set, defaults to None |
param worksheet: | |
---|---|
worksheet to handle, defaults to active worksheet if None | |
param row: | target row, defaults to None |
param column: | target row, defaults to None |
param value: | possible value to set, defaults to None |
param number_format: | |
possible number format to set, defaults to None | |
param formula: | possible format to set, defaults to None |
raises ValueError: | |
if cell is not given |