openpyxl_Center align issue

I am having some issues with the center align running this code:

align = Alignment(horizontal="center", vertical="center") for ws in wb:    for row in ws:        for cell in row:            print(cell.coord)            ws.alignment = align 

The result is formated first column and first row eventhough I can tell is iterating through all the cells…

Anyone know if there is any possible formating override? I created the file before the formating with such line:

with pd.ExcelWriter('EXPORT_'+inparchivo+'_'+datearchivo+'.xlsx', engine='openpyxl') as writer:     df7.to_excel(writer, sheet_name = 'No Actividad')  

I can tell that there is some formating in the titles (bold) that I did not set up myself and funnily enough is where the alignment works properly. It looks like the rest of the cells are somehow protected.

Thanks in advance

Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.