How to import CSV file and load all data in table view at frontend side in Django App?


(PARTH JANI) #1

I am new to Django and my question is when the user can import CSV and click on the button then after CSV inside all data load in table view in Django app frontend side how ?

Above functionality already excellent working in Django administration side but I want it at frontend side.

Please elaborate which step required, I already installed “pip install django-import-export” library


(Vitor Freitas) #2

As far as I know, the django-import-export library only work like that inside Django Admin. Not sure if it is possible to use this preview table outside it…

I have done a somewhat similar implementation in a project recently:

This picture above is the preview table before importing a list of users.

Here you can see the HTML template:

And the implementation is inside the view:

And inside the form:

This is a very specific/more complex use case. But maybe you can get some ideas on how to do it


(PARTH JANI) #3

Thank you so much VITOR, i try it but not working in my app but i get some idea i used pandas library and using its functionality about import and read, i hope its worked.
I will update you regarding this issue , i will try hard to solved it ,any how


(Basil Jose) #4

Just for your information, if you are using PSQL as DB, you can use django-postgres-copy its super fast.


(PARTH JANI) #5

Unfortunately i am not used PSQL,but now its fixed with the use of pip install openpyxl by the way thank you Basil