from excel_com import excel_com
from class_excel_format import format
#Example of usage for excel_class
def main():
x=excel_com()
f=format()#Formatting class
x.connect()#Connect to Excel program
x.add_workbook()#Add workbook
x.delete_sheet("Sheet3")# Delete sheet by name
x._set_cell_value(sheet="Sheet1", row=1, col=1, value='Hello!') #Write value of single cell
data=[
['Col1','Col2','Col3'],
[1,5,2],
[2,4,3],
[3,3,4],
[4,2,5]
]
#Set value of range of cells using data from list
x._set_range_value(sheet="Sheet1",row1=2, col1=1,row2=6, col2=3,data=data,type='value')
#Set borders for single cell
borders={
'xlEdgeTop':{'LineStyle':'xlContinuous','Weight':'xlThin'},
'xlEdgeBottom':{'LineStyle':'xlContinuous','Weight':'xlThin'},
'xlEdgeLeft':{'LineStyle':'xlContinuous','Weight':'xlThin'},
'xlEdgeRight':{'LineStyle':'xlContinuous','Weight':'xlThin'}
}
x.set_cell_borders(sheet="Sheet1", row=1, col=1,format_data=borders)
#Set borders for selection
x._select_range(sheet="Sheet1",row1=2, col1=1,row2=6, col2=3)#Select range of cells
x.set_cell_borders_selection(borders)#Set bordets for selected cells
if __name__=="__main__":
main()
exit(0)