[Answered ]-Using django-import-export: How to customise which fields to export Excel files

1👍

If you want to define which fields should be exported, refer to this post. This means that only those fields will be exported, and the user cannot choose. This is relatively simple to achieve.

However it seems like you want the user to be able to choose the fields in the UI, then it is more complicated, and will involve more customisation. The answer you link to is the starting point.

There will have to be some UI element in which the user can choose the fields for export (e.g. some multi select widget). Then on POST, you’ll have to read the ids of those fields and then feed that into the export() method.

If you are new to Django, it’s going to take a bit of work to implement, and will be quite a steep learning curve. If you can find a "clean" way to implement it, such that future users would be able to implement, we would consider a PR.

Leave a comment