Click here to Skip to main content
15,441,280 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
(sorry for my bad english)

Hi!

I work with Django and pandas in a project of a web app.
I need write records in a excel archive from a HTML formulary, but every time that i write a new record, the old record is deleted. I need write this in three archives.

I use {% block content %} {% csrf_token %}(more code){% endblock %} for capture information from the forms

What I have tried:

def formulario_mtto(request):    
    mensaje="Registro realizado:"
    dataa = request.POST.dict()
    print(mensaje,type(dataa), dataa) 
    pd.DataFrame.from_dict(dataa.items()).to_excel('registros_mtto_anual.xlsx',index=[0])
    pd.DataFrame.from_dict(dataa.items()).to_excel('registros_mtto_mensual.xlsx',index=[0])
    pd.DataFrame.from_dict(dataa.items()).to_excel('registros_mtto_historico.xlsx',index=[0])
    return render(request,'formulario_mtto.html')
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900