Answer the question
In order to leave comments, you need to log in
Why is it not being written to *.xlsx file in Python?
Hello, I don’t know why, but my data does not want to be saved in an excel file ((
wb = load_workbook('output/output.xlsx')
def write_fields_to_excel(name):
if name not in wb.sheetnames:
ws = wb.create_sheet(name)
for k in sorted(fields):
ws[k] = fields[k]
wb.save('output/output.xlsx')
def write_to_excel(data, pos, name):
ws = wb[name]
ws['A' + pos] = pos - 1
ws['B' + pos] = data.get('Полное наименование/ФИО ИП', '')
ws['C' + pos] = data.get('Адрес места нахождения ЮЛ/ИнЮЛ или жительства ИП', '')
ws['D' + pos] = data.get('ОГРН', '')
ws['E' + pos] = data.get('В лице', '')
ws['F' + pos] = data.get('ФИО руководителя', '')
ws['G' + pos] = data.get('Номер телефона', '')
ws['H' + pos] = data.get('Адрес электронной почты', '')
ws['I' + pos] = data.get('Регистрационный номер', '')
ws['J' + pos] = data.get('Дата начала действия', '')
ws['K' + pos] = data.get('Дата окончания действия', '')
ws['L' + pos] = data.get('Схема декларирования', '')
ws['M' + pos] = data.get('Статус', '')
ws['N' + pos] = data.get('Стандарты', '')
ws['O' + pos] = data.get('ТН ВЭД', '') if data.get('ТН ВЭД', '') else data.get('ТН ВЭД ТС', '')
wb.save('output/output1.xlsx')
print('done')
write_fields_to_excel(name)
...
data[key] = value
write_to_excel(data, pos, name)
...
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question