I have a postgresql database and I want to add data to it. I want to upload an excel file containing the data and save it to database. I have a backend server of django and a frontend server of React. I am easily able to import the data from the excel sheet to database using django_import_export but from the django admin. What I want is, to do this using React and for normal users(non superusers) also. Is there a way to integrate django_import_export with react? Any other way to implement this functionality is also apreciated.
1 Answer
Presumably your backend uses a REST API to handle requests from the frontend. So, you can write an API handler which receives the Excel data posted to it.
The Django API handler can create an import process to handle upload. Check the documentation for more information.
Note that if you are loading large files, then you might want to handle the upload asychronously. This is little more tricky, but you could look at Celery to help with this.