I can't keep the same styles of cells in editing xlsx file
Created originally on Bitbucket by khchine5 (Khchine Hamza)
Hi Eric, l would like to edit my xlsx file by setting the value of cells . but by saving the output file i loose ths styles of my cells.
my code :
#!python
root_path = get_module_path('nrb_nrsol')
lot = self.browse(cr, uid, ids, context=context)[0]
file_path_src = root_path + "/lot/lot_files/Formulaires_02.xlsx"
file_path_des = root_path + "/lot/lot_files/Formulaires_02_out.xlsx"
wb = load_workbook(file_path_src )
ws = wb.get_sheet_by_name("DETAILS DOSSIERS")
for idx, line in enumerate(lot.lot_line, 4):
ws['B%s' % idx] = 'test'
wb.save(file_path_des)
Files attaches:
- Formulaires_02.xlsx : the input file
- Formulaires_02_out.xlsx : the output file
Thx
Attachments: Formulaires_02.xlsxFormulaires_02_out.xlsx