Import CSV file with django

Hi,

I am trying to import a csv file in my database. For some reason, I don`t manage to loop the csv file and only the 1st line of the file is being displayed.

I`ve put every details on here https://stackoverflow.com/questions/60806049/import-csv-file-with-django

Have you got an idea what is happening?

Thanks

There is a dedicated Python module for CSV handling: https://docs.python.org/3/library/csv.html
Use that and do not try to parse the file yourself.

2 Likes

Thank you, I`ll change my code. By any chance, if you know any tutorial please let me know.

Thanks

Iā€™d say that the code samples in the official Python docs are already a good start.