1

I'm trying to use Pandas, but keeping the format of the template when I use "pd.read_excel". I found out that "StyleFrame" could solve my problem, and it actually did after saving the model without any change. Nevertheless after my code change the informations, I can't save the file properly... I keep having this error: AttributeError: 'str' object has no attribute 'style'. I read that the problem is that it tries to apply styles to the data my code wrote, but it doesn't need to. I only need to keep the format of the template I import... The whole code works, the problem is when I try to save to excel. Can someone help?

planilha.iloc[[16], [1]] = numero_remessa #String
planilha.iloc[[31], [1]] = peso #Float
planilha.iloc[[29], [1]] = info_materiais #String
planilha.iloc[[27], [1]] = sum(pallets) #Int
planilha.to_excel(f'C:/Users/usuario/Desktop/Python/PyCharm/Wanger/{str(numero_remessa).replace("/","-")[5:13]}.xlsx').save() 
    #The error appears in this last line even if I save with a regular name.

0 Answers0