Solution: Made a fix for excel library keywords 'Put String to Cell', 'Put Number to Cell' and 'Put Date to Cell'. Copy code snippet under each function to your excel library file.
Steps:
In pycharm, open the ExcelLibrary project - C:\Python27\Lib\site-packages\ExcelLibrary.
Open the ExcelLibrary.py file and copy code snippet under each function into your file
Then, execute command python __init__.py, this will place compiled file into your ExcelLibrary package.
Only change is input date format, it should be given as dd-mm-yyyy
def put_string_to_cell(self, sheetname, column, row, value):
if self.wb:
my_sheet_index = self.sheetNames.index(sheetname)
if not self.tb:
self.wb.sheets()
self.tb = copy(self.wb)
if self.tb:
plain = easyxf('')
self.tb.get_sheet(my_sheet_index).write(int(row), int(column), value, plain)
Date input should be in format: dd-mm-yyyy ex: 25-12-2016
def put_date_to_cell(self, sheetname, column, row, value):
if self.wb:
my_sheet_index = self.sheetNames.index(sheetname)
# cell = self.wb.get_sheet(my_sheet_index).cell(int(row), int(column))
# if cell.ctype is XL_CELL_DATE:
if not self.tb:
self.wb.sheets()
self.tb = copy(self.wb)
if self.tb:
print(value)
# dt = value.split('.')
# dti = [int(dt[2]), int(dt[1]), int(dt[0])]
# print(dt, dti)
ymd = datetime.strptime(value, '%d-%m-%Y')
print(ymd)
plain = easyxf('', num_format_str='d-M-yyyy')
self.tb.get_sheet(my_sheet_index).write(int(row), int(column), ymd, plain)
def put_number_to_cell(self, sheetname, column, row, value):
if self.wb:
my_sheet_index = self.sheetNames.index(sheetname)
# cell = self.wb.get_sheet(my_sheet_index).cell(int(row), int(column))
# if cell.ctype is XL_CELL_NUMBER:
if not self.tb:
self.wb.sheets()
self.tb = copy(self.wb)
if self.tb:
plain = easyxf('')
self.tb.get_sheet(my_sheet_index).write(int(row), int(column), float(value), plain)
Hope this will help lot of people who want to write data to excel.
Thanks
Sathish