Excel Actions
Excel Actions are actions to interact with Excel files.
Actions
excel.append
Append new lines to the end of spreadsheet.
Parameters:
worksheet - worksheet to be used for cell getting.
line_values (optional) - array with each index been a different column, example:
['Col 1', 'Col 2', 'Col 3']
grid_values (optional) - a grid where each line will represent a line and each line element will represent a column, example:
[
['Line 1 - Col1', 'Line 1 - Col2', 'Line 1 - Col3'],
['Line 2 - Col1', 'Line 2 - Col2', 'Line 2 - Col3']
]
Returns:
This action has no return.
Exceptions:
This action returns no Exception
excel.convert_to_xlsx
Convert any kind of file that Excel could open (for example: XLS, CSV), to XLSX file. The converted file will be saved at the same path and with the same name, with .xlsx extension.
Important: To use this action, the Excel software must be installed on the machine and all Excel windows should be closed.
Parameters:
filepath - Path to the file that will be converted.
Returns:
This action has no return.
Exceptions:
This action returns no Exception
excel.create_new
Create a completelly new spreadsheet.
Important: to save this spreadsheet on a folder, the excel.save action should be called.
Parameters:
This actions has no parameters.
Returns:
workbook - Workbook to be used with other Excel actions
worksheet - Active worksheet of the file
Exceptions:
This action returns no Exception
excel.delete_rows
Deletes the entire rows of between the start row number and the end row number.
Parameters:
worksheet - Worksheet to be used for deleting rows.
start - number of the first row to be deleted.
end (optional) - number of the last row to be deleted. If just a single row need to be deleted, this parameter doesn't need to be informed.
Returns:
This action has no return.
Exceptions:
This action returns no Exception
excel.get_cell
Returns the value of a cell or a range of cells.
Parameters:
worksheet - Worksheet to be used for cell getting.
range - Range of the cells to get value using Excel pattern, ex: A1:C3
Returns:
first_col - Letter of the first column returned
first_row - Number of the first row returned
last_col - Letter of the last column returned
last_row - Number of the last row returned
values - Array of values, where the first index if the row, and the second if the column, ex: values[0][1] will get the values of the first line, second column.
Exceptions:
InvalidRange: when a wrong or invalid range if given
excel.get_dimensions
Return the worksheet dimensions as Excel range.
Parameters:
workshet - Worksheet to return the last line.
Returns:
range - Range of the worksheet used area, as Excel pattern. Ex: A1: F150.
first_cell - Reference of the first cell on range, ex: A1.
last_cell - Reference of the last cell on range, ex: F150.
Exceptions:
This action returns no Exception
excel.last_line
Return the last line of the worksheet
Parameters:
workshet - Worksheet to return the last line.
Returns:
last_line - Number of the last line of the worksheet
Exceptions:
This action returns no Exception
excel.open
Open an given Excel file to start interacting with other Excel Actions.
Parameters:
filepath - path to Excel file.
Returns:
workbook - Workbook to be used with other Excel actions
worksheet - Active worksheet of the file
Exceptions:
FileNotFoundException: if the file path is wrong or does not exists.
excel.save
Saves the Workbook with all updates.
Parameters:
workbook - Workbook that has been updated.
filepath - File name with full file path, to save location.
Returns:
This actions has no returns
Exceptions:
FileNotFoundException: if the given file path could not be used.
excel.select_sheet
Selects a new sheet to use with Excel file.
Parameters:
workbook - Workbook returned be excel.open.
sheet_name (optional) - Name of the sheet to be returned. If no sheet name is given will return the active sheet
Returns:
workbook - Workbook to be used with other Excel actions
worksheet - Worksheet with the given name, or active worksheet of the file if no sheet_name is given.
Exceptions:
This action doesn't return any exceptions
excel.update_cell
Updates the value of a given cell on Excel file.
Parameters:
worksheet - Worksheet to be used for cell getting.
value - Value to be inserted on the given cell.
cell - Reference of the cell, using Excel pattern, ex: A1
Returns:
first_col - Letter of the first column returned
first_row - Number of the first row returned
last_col - Letter of the last column returned
last_row - Number of the last row returned
values - Array of values, where the first index if the row, and the second if the column, ex: values[0][1] will get the values of the first line, second column.
Exceptions:
InvalidRange: when a wrong or invalid range if given