IExcelFile

Summary

Represents an Excel File object.

Methods

Structure

class IExcelFile
adjustCellsToContent()

Adjusts the size of the cells to their content.

adjustColumnWidth(WorksheetName: str, Column: int32, width: float)

Adjusts the width of a specific column given the column's number.

Parameters
  • WorksheetName (str) – Desired worksheet name.

  • Column (int32) – Desired worksheet column number.

  • width (float) – Desired width.

adjustColumnWidth(WorksheetName: str, Column: str, width: float)

Adjusts the width of a specific column given the column's name.

Parameters
  • WorksheetName (str) – Desired worksheet name.

  • Column (str) – Desired worksheet column name.

  • width (float) – Desired width.

adjustRowHeight(WorksheetName: str, Row: int32, height: float)

Adjust the height of a specific row.

Parameters
  • WorksheetName (str) – Desired worksheet name.

  • Row (int32) – Desired row's number.

  • height (float) – Desired height.

close()

Closes the file.

containWorksheet(WorksheetName: str) bool

Checks if the excel file contains a specific worksheet or not given its name.

Parameters

WorksheetName (str) – Name of the worksheet.

Returns

True if the worksheet exists in the file, False otherwise.

Return type

bool

Deletes a hyper link from a specific cell in a specific worksheet.

Parameters
  • WorksheetName (str) – Worksheet's name.

  • cell (str) – Cell's coordinates (i.e A5).

deleteCellHyperlink(WorksheetName: str, Row: int32, Column: int32)

Deletes a hyper link from a specific cell in a specific worksheet.

Parameters
  • WorksheetName (str) – Desired worksheet name.

  • Row (int32) – Row number of the desired cell.

  • Column (int32) – Columns number of the desired cell.

getCellValue(WorksheetName: str, cell: str) object

Gets the cell value of a specific cell in a specific worksheet given the cell's coordinates.

Parameters
  • WorksheetName (str) – Desired worksheet name.

  • cell (str) – Desired cell's coordinates (i.e A5).

Returns

Value object of the cell.

Return type

object

getCellValue(WorksheetName: str, Row: int32, Column: int32) object

Gets the cell value of a specific cell in a specific worksheet given the cell's coordinates.

Parameters
  • WorksheetName (str) – Desired worksheet name.

  • Row (int32) – Row number of the desired cell.

  • Column (int32) – Column number of the desired cell.

Returns

Value object of the cell.

Return type

object

getFirstFreeRow(WorksheetName: str) int32

Gets the number of the first free line of the table in a worksheet.

Parameters

WorksheetName (str) – Desired worksheet name.

Returns

The line number of the first free row.

Return type

int32

getLineValues(WorksheetName: str, Row: int32) List[object]

Gets a list of the cells value of a specific line.

Parameters
  • WorksheetName (str) – Desired worksheet name.

  • Row (int32) – Desired row number.

Returns

List of values.

Return type

List[object]

getSheetsList() List[object]

Gets a list of the sheets of the file.

Returns

List of sheets.

Return type

List[object]

insertCell(WorksheetName: str, cell: str, cellContent: str)

Inserts a cell in a specific worksheet.

Parameters
  • WorksheetName (str) – Desired worksheet name.

  • cell (str) – The cell's coordinates (i.e A5).

  • cellContent (str) – The cell's content.

insertCell(WorksheetName: str, Row: int32, Column: int32, cellContent: str)

Inserts a cell in a specific worksheet.

Parameters
  • WorksheetName (str) – Desired worksheet name.

  • Row (int32) – Row number of the cell.

  • Column (int32) – Column number of the cell.

  • cellContent (str) – Cell' content.

insertCell(WorksheetName: str, cell: str, cellContent: str, FontColor: str, BackgroundColor: str, WithBorders: bool)

Inserts a cell in a specific worksheet.

Parameters
  • WorksheetName (str) – Desired worksheet name.

  • cell (str) – The cell's coordinates.

  • cellContent (str) – The cell's content (i.e A5).

  • FontColor (str) – The font color of the cell.

  • BackgroundColor (str) – The background color of the cell0

  • WithBorders (bool) – True if borders are needed to be added, False otherwise.

insertCell(WorksheetName: str, Row: int32, Column: int32, cellContent: str, FontColor: str, BackgroundColor: str, WithBorders: bool)

Inserts a cell in a specific worksheet.

Parameters
  • WorksheetName (str) – Desired worksheet name.

  • Row (int32) – Row number of the cell.

  • Column (int32) – Column number of the cell.

  • cellContent (str) – The cell's content.

  • FontColor (str) – The font color of the cell.

  • BackgroundColor (str) – The background color of the cell.

  • WithBorders (bool) – True if borders are needed to be added, False otherwise.

insertCellRange(WorksheetName: str, firstCell: str, lastCell: str, cellContent: str)

Inserts a cell range in a specific worksheet.

Parameters
  • WorksheetName (str) – Desired worksheet name.

  • firstCell (str) – Coordinates of the first cell in the range (i.e A5).

  • lastCell (str) – Coordinates of the last cell in the range (i.e D10).

  • cellContent (str) – Cells contents

insertCellRange(WorksheetName: str, firstCell: str, lastCell: str, cellContent: str, FontColor: str, BackgroundColor: str, WithBorders: bool)

Inserts a cell range in a specific worksheet.

Parameters
  • WorksheetName (str) – Desired worksheet name.

  • firstCell (str) – Coordinates of the first cell in the range (i.e A5).

  • lastCell (str) – Coordinates of the last cell in the range (i.e D10).

  • cellContent (str) – Cells content.

  • FontColor (str) – Font color of the cells.

  • BackgroundColor (str) – Background color of the cells.

  • WithBorders (bool) – True if borders are needed to be added, False otherwise.

insertComment(WorksheetName: str, cell: str, comment: str)

Inserts a comment in a specific cell of a specific worksheet.

Parameters
  • WorksheetName (str) – Desired worksheet name.

  • cell (str) – Cell's coordinates (i.e A5).

  • comment (str) – Comment to be inserted.

insertComment(WorksheetName: str, Row: int32, Column: int32, comment: str)

Inserts a comment in a specific cell of a specific worksheet.

Parameters
  • WorksheetName (str) – Desired worksheet name.

  • Row (int32) – Cell's row number.

  • Column (int32) – Cell's column number.

  • comment (str) – Comment to be inserted.

insertLine(WorksheetName: str, listOfElements: object)

Inserts a line after the last row in the table of a specific sheet.

Parameters
  • WorksheetName (str) – Desired worksheet name.

  • listOfElements (object) – The list of the elements to be inserted in the row.

insertLine(WorksheetName: str, listOfElements: object, RowNumber: int32)

Inserts a line at a specific row number in the table of a specific sheet.

Parameters
  • WorksheetName (str) – Desired worksheet name.

  • listOfElements (object) – The list of the elements to be inserted in a row.

  • RowNumber (int32) – The row number at which the line will be inserted.

insertLine(WorksheetName: str, listOfElements: object, FontColor: str, BackgroundColor: str, WithBorders: bool)

Inserts a line after the last row in the table of a specific sheet.

Parameters
  • WorksheetName (str) – Desired worksheet name.

  • listOfElements (object) – The list of elements to be inserted in the row.

  • FontColor (str) – The font color of the cells.

  • BackgroundColor (str) – The background color of the cells.

  • WithBorders (bool) – True if borders are needed to be added, False otherwise.

insertLine(WorksheetName: str, listOfElements: object, FontColor: str, BackgroundColor: str, WithBorders: bool, RowNumber: int32)

Inserts a line at a specific row number in the table of a specific sheet.

Parameters
  • WorksheetName (str) – Desired worksheet name.

  • listOfElements (object) – The list of the elements to be inserted in a row.

  • FontColor (str) – The font color of the cells.

  • BackgroundColor (str) – The background color of the cells.

  • WithBorders (bool) – The background color of the elements.

  • RowNumber (int32) – The row number at which the line will be inserted.

insertWorksheet(WorksheetName: str)

Inserts a new worksheet in the excel file.

Parameters

WorksheetName (str) – Name of the worksheet.

lockWorksheet(WorksheetName: str)

Locks a specific worksheet to prevent unwanted modification.

Parameters

WorksheetName (str) – Worksheet name.

lockWorksheet(WorksheetName: str, password: str)

Locks a specific worksheet to prevent unwanted modification with a protection password.

Parameters
  • WorksheetName (str) – Worksheet name.

  • password (str) – Protection password.

modifyCellFormula(WorksheetName: str, cell: str, formula: str)

Modifies the formula of a specific cell to a specific formula in a specific worksheet.

Parameters
  • WorksheetName (str) – Desired worksheet name.

  • cell (str) – The cell's coordinates.

  • formula (str) – The formula to be inserted.

modifyCellHyperlinkInSameSheet(WorksheetName: str, cell: str, linkToAddressInSameWorksheet: str)

Modifies the hyper link of a specific cell to a specific hyper link in the same sheet in a specific worksheet.

Parameters
  • WorksheetName (str) – Desired worksheet name.

  • cell (str) – Cell's coordinates (i.e A5).

  • linkToAddressInSameWorksheet (str) – The hyper link to the same sheet to be inserted.

modifyCellHyperlinkInSameSheet(WorksheetName: str, Row: int32, Column: int32, linkToAddressInSameWorksheet: str)

Modifies the hyper link of a specific cell to a specific hyper link in the same sheet in a specific worksheet.

Parameters
  • WorksheetName (str) – Desired worksheet name.

  • Row (int32) – Row number of the desired cell.

  • Column (int32) – Columns number of the desired cell.

  • linkToAddressInSameWorksheet (str) – The hyper link to the same sheet to be inserted.

modifyCellHyperlinkToFile(WorksheetName: str, cell: str, linkToOtherFile: str)

Modifies the hyper link of a specific cell to a specific hyper link of a file in a specific worksheet.

Parameters
  • WorksheetName (str) – Desired worksheet name.

  • cell (str) – The cell's coordinates (i.e A5).

  • linkToOtherFile (str) – The file's hyper link to be inserted.

modifyCellHyperlinkToFile(WorksheetName: str, Row: int32, Column: int32, linkToOtherFile: str)

Modifies the hyper link of a specific cell to a specific hyper link of a file in a specific worksheet.

Parameters
  • WorksheetName (str) – Desired worksheet name.

  • Row (int32) – Row number of the desired cell.

  • Column (int32) – Columns number of the desired cell.

  • linkToOtherFile (str) – The file's hyper link to be inserted.

modifyCellHyperlinkToOtherSheet(WorksheetName: str, cell: str, worksheetOfLink: str, cellOfLink: str)

Modifies the hyper link of a specific cell to a specific hyper link to another sheet in a specific worksheet.

Parameters
  • WorksheetName (str) – Desired worksheet name.

  • cell (str) – The cell's coordinates (i.e A5).

  • worksheetOfLink (str) – The sheet to be linked to.

  • cellOfLink (str) – The cell in the worksheet to be linked to.

modifyCellHyperlinkToOtherSheet(WorksheetName: str, Row: int32, Column: int32, worksheetOfLink: str, cellOfLink: str)

Modifies the hyper link of a specific cell to a specific hyper link to another sheet in a specific worksheet.

Parameters
  • WorksheetName (str) – Desired worksheet name.

  • Row (int32) – Row number of the desired cell.

  • Column (int32) – Columns number of the desired cell.

  • worksheetOfLink (str) – The sheet to be linked to.

  • cellOfLink (str) – The cell in the other worksheet to be linked to.

modifyCellRangeFormula(WorksheetName: str, firstCell: str, lastCell: str, formula: str)

Modifies the formula of a specific range in a specific worksheet.

Parameters
  • WorksheetName (str) – Desired worksheet name.

  • firstCell (str) – Coordinates of the first cell in the range.

  • lastCell (str) – Coordinates of the last cell in the range.

  • formula (str) – The formula to be inserted.

save()

Saves the file.