react-spreadsheet-import
react-spreadsheet-import copied to clipboard
Allow downloading template file during flow
Hello !
Description
On your example page you provide a template file BEFORE starting RSI flow. In my use case, I have multiple RSI Modals for different data structures (each with different columns and validation rules) I usually have a button to trigger RSI flow and I "could" add an option next to it in order to allow user to download a template file BUT it will add an action I'm not sure my users will understand + sometime the RSI flow option is in a list of other options and it will be hard to understand that these to options are related.
Context
It seems to be a normal use-case to give the user a template file (in order to avoid avoid copy/pasting all headers) It would be awesome to have this "download template" option on the FileSelection step !
Solutions
I can see multiple ways of doing it :
- Have a button on the first step that allow direct download of template file (next to title ? Next to "upload file" ?)
- Have the ability to add custom React Components on an area of the first step (next to title ?)
Plus, the "download template file" should have a specific callback that accepts a file and download it (file can then be downloading from an API or file cloud, or just generated from a JSON object)
I think this is a common use case and adding a specific button is acceptable. And if no callback is given this button is hidden to have the same behavior as the actual.
I'd be glad to discuss about it. Let me know if this is something you can consider or not. And if you give me the specifications you are ready to add to your lib, I can create a PullRequest if you want :)
Have a good day !
Hey @JulienGasparLopes I think it's a great idea! PRs are always welcome! There are a few possibilities:

I probably would go with the first option. And I don't think user needs to provide a file when we can generate it using the provided fields prop. We have XLSX library (https://sheetjs.com/demo/table), that should be able to generate a .xlsx file.
Hey ! Thanks for the images, yes I also think first option is the best
Maybe allowing user to add informations on the file is a good thing. For example it allows to add one or more examples rows or information rows (description of the field, description of the rules (required, unique ...), possible values ...)
But yes we don't have to pass a file, maybe a simple list of dict representing the rows will be sufficient. What de you think ?
So if I create a PR i would do :
- adding by default the button to download example file
- on ReactSpreadSheet main component, add an optional parameter
template_file_rowsto pass other rows to the component in case user downloads the file
Would it be okey for you ?
This is going to be a super helpful feature for our implementation. @JulienGasparLopes, any movement on this?
I'm looking for this exact feature, any chance it's already been implemented @JulienGasparLopes ?