Add New Sheet
Add new worksheet to workbook. Workbook is created by default if it does not exist.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
sheetname | str | name for sheet | |
tabname | str | None | name for tab (deprecated) |
create_workbook | bool | True | create workbook if True, defaults to True |
Add new worksheet to workbook. Workbook is created by default if it does not exist.
param sheetname: | |
---|---|
name for sheet | |
param tabname: | name for tab (deprecated) |
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 |
Add New Workbook
Adds new workbook for Excel application
Close Document
Close the active document (if open).
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
save_changes | bool | False |
Find First Available Cell
Find first available free cell
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
worksheet | typing.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 Row
Find first available free row
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
worksheet | typing.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: | row or None |
Open Application
Open the Excel application.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
visible | bool | False | show window after opening |
display_alerts | bool | False | show alert popups |
param visible: | show window after opening |
---|---|
param display_alerts: | |
show alert popups |
Open Workbook
Open Excel by filename
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
filename | str | path to filename |
By default sets active worksheet to sheet number 1
param filename: | path to filename |
---|
Quit Application
Quit the application.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
save_changes | bool | False |
Read From Cells
Read value from cell.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
worksheet | typing.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 Macro
Run Excel macro with given name
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
macro_name | str | macro to run | |
*args | typing.Any |
System Message: WARNING/2 ( |
param macro_name: | |
---|---|
macro to run |
|
param *args: | arguments to pass to macro |
Save Excel
Saves Excel file
Save Excel As
Save Excel with name if workbook is open
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
filename | str | where to save file | |
autofit | bool | False | autofit cell widths if True, defaults to False |
param filename: | where to save file |
---|---|
param autofit: | autofit cell widths if True, defaults to False |
Set Active Worksheet
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 To Cells
Write value, number_format and/or formula into cell.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
worksheet | typing.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 |