I'm getting some data from MongoDB and sending it to Excel. I'm using openpyxl but some workbooks show the following error when I open them:
"we found some problem with some content in excel ...".
Could anyone help me?
Code:
ws = wb.activeclient = pymongo.MongoClient("...")
db = client['...']
collection = db['...']
r = 2
for doc in collection.find({'is_timeline_valid': True}):
for dic in doc['timeline']['datas']:
if 'pedido' in dic['tramite'].lower():
ws.cell(row = r, column = 1).value =doc['id_process_unformatted']
ws.cell(row = r, column = 2).value = dic['data']
ws.cell(row = r, column = 3).value = dic['tramite']
wb.save('pedido.xlsx')
print('*****************************')
print(dic['tramite'])
r += 1