Package: easierexcel
easierexcelEasierExcel allows for an easy way to get and update cell values within Excel sheets.OpenPyXL is used to do the bulk while easierexcel makes it much easier to use.76% Test CoveragePython 3.11+Quick StartInstall easierexcel using pip:$pipinstalleasierexcelExample TableNameBirth MonthAgeNullJohnJohn31nullMichaelJune31nullBrianAugust30nullRobJuly34nullAllisonSeptember32nullCode ExamplefromeasierexcelimportExcel,Sheet# class initexcel=Excel('example_excel.xlsx')# formatting optionsoptions={"shrink_to_fit_cell":True,"header":{"bold":True,"font_size":16},"default_align":"center_align","left_align":["Name",],"percent":["%","Percent","Discount","Rating Comparison","Probable Completion",],"currency":["Price","MSRP","Cost"],"integer":["ID","Number"],"date":["Last Updated","Date"],}example=Sheet(excel,"Name",sheet_name="Example",options=options)# deletingexample.delete_column("Null")example.delete_row("John")# adding a new linedata={"Name":"Billy","Birth Month":"December","Age":5,}example.add_new_line(cell_dict=data)# accessing and updatingexample.get_cell("Michael","Birth Month")# -> Juneexample.update_cell("Michael","Birth Month","April")example.get_cell("Michael","Birth Month")# -> Aprilexcel.save()# Saves the excel fileFinal TableNameBirth MonthAgeMichaelApril31BrianAugust30RobJuly34AllisonSeptember32BillyDecember5DocumentationExcel ClassAllows retreiving, adding, updating, deleting and formatting cells within Excel.initFunctionfilenameis the path to the excel file.use_loggingallows disabling all logs when running.log_filesets the path for logging.log_levelSets the logging level of this logger.
level must be an int or a str.save FunctionBacks up the excel file before saving the changes ifbackupis True.It will keep trying to save until it completes in case of permission
errors caused by the file being open.use_printdetermines if info for the saving progress will be printed.force_savecan be used to make sure a save occurs.open_excel FunctionOpens the current excel file if it still exists and then exits.Saves changes ifsaveis True.Thetestarg is only used for testing.Sheet ClassinitFunctionAllows interacting with any one sheet within the excel_object given.excel_objectExcel object created using Excel class.column_nameName of the main column you intend to use for
identifying rows.sheet_nameName of the sheet to use.optionsused to determine auto formatting.create_dataframe FunctionCreates a panda dataframe using the current used sheet.date_colssets the columns with dates.na_valssets what should be considered N/A values that are ignored.indirect_cell FunctionReturns a string for setting an indirect cell location to a cell.If you want the cell to be relative to column names then setcur_colto the column name the formula is going into andref_colto the
column name you are wanting to reference.If you know it is simply references a cell that is 3 to the right or
left then just giveleftorrightthat value. Only one direction
can be greater than 0.You can also usemanual_setto set the indirect cell offset manually
using a positive or negative number.get_column_index FunctionCreates the column index.get_row_index FunctionCreates the row index based oncol_name.list_in_string FunctionReturns True if any entry in the givenlistis in the givenstring.Settinglowercaseto True allows you to make the check
set all to lowercase.get_row_col_index FunctionGets the row and column index for the given values if they exist.Will return therow_valueandcolumn_valueif they are
numbers already.extract_hyperlink FunctionExtracts the hyperlink target from acell_valuewith the hyperlink
formula.This is only needed if excel has not applied the hyperlink yet.
This often happens when you click on the cell with the hyperlink
formula.get_cell_by_key FunctionGets the cell value based on therow_keyandcolumn_key.
This is basically the index in excel for columns and rows.If the cell is a hyperlink that is currently clickable,
the hyperlink target will be returned.get_cell FunctionGets the cell value based on therow_valueandcolumn_value.If the cell is a hyperlink that is currently clickable,
the hyperlink target will be returned.update_index FunctionUpdates the current row with thecolumn_keyin the row_idx variable.update_cell_by_key FunctionUpdates the cell based onrow_keyandcol_keytonew_val.
This is basically the index in excel for columns and rows.Returns True if cell was updated and False if it was not updated.replaceallows you to determine if a cell will have its
existing value changed if it is not None.update_cell FunctionUpdates the cell based onrow_valandcol_valtonew_val.Returns True if cell was updated and False if it was not updated.replaceallows you to determine if a cell will have its
existing value changed if it is not None.add_new_line FunctionAdds cell_dict onto a new line within the excel sheet.
The column_name must be given a value.If dictionary keys match existing columns within the set sheet,
it will add the value to that column.delete_row FunctionDeletes row bycolumn_value.delete_column FunctionDeletes column bycolumn_name.set_border FunctionSets the givencellborder to cover all sides with the givenstyle.set_fill FunctionSets the givencellto have fill withcolorandfill_typeset_style FunctionSets the givencellto the givenformator general by default.format_picker FunctionDetermines what formatting to apply to a column.get_column_formats FunctionGets the formats to use for each column.format_header FunctionFormats the top header of the sheet.format_cell FunctionFormats a cell based on thecolumnname usingrow_iandcol_i.format_row FunctionFormats the entire row byrow_identifierformat_all_cells FunctionAuto formats all cells.