17๐
Use http://www.python-excel.org/ and consider this process:
- Make a view where user can upload the xls file.
- Open the file with xlrd.
xlrd.open_workbook(filename)
- Extract, create dict to map the data you want to sync in db.
- Use the models to add, update or delete the information.
If you follow the process, you can learn a lot of how loading and extracting works and how does it fits with the requirements. I recommend to you first do the step 2 and 3 in shell to get more quicker experiments and avoid to be uploading/testing/error with a django view.
Hope this kickoff base works for you.
12๐
Why donโt you use django-import-export?
Itโs a widget that allows you to import excel files from admin section.
Itโs very easy to install, here you find the installation tutorial, and here an example.
- [Django]-Troubleshooting Site Slowness on a Nginx + Gunicorn + Django Stack
- [Django]-Django Background Task
- [Django]-What does 'many = True' do in Django Rest FrameWork?
5๐
Excel spreadsheets are saved as .csv files, and there are plenty of examples and explanations on how to work with them, such as here and here, online already.
In general, if you are having difficulty understanding documentation or packages, my advice would be to search for specific examples or see if whatever you are trying to do has already been done. Play with it to get a working understanding, and then modify it to fit your needs.
- [Django]-Parsing unicode input using python json.loads
- [Django]-Django REST framework post array of objects
- [Django]-How do I run tests against a Django data migration?