react-bootstrap-table icon indicating copy to clipboard operation
react-bootstrap-table copied to clipboard

Export to CSV download only specific columns

Open anvk opened this issue 10 years ago • 9 comments

I hope it is not too hard to add functionality to this component to be able to download not ALL columns in a table through "Export to CSV" button. I have some columns where I keep Edit/Delete links and they appear in CSV whenever user clicks ExportToCSV button.

Thanks !

anvk avatar Jul 15 '16 19:07 anvk

I have the same request. I have a column named "Actions" that has add/edit/delete buttons that get included in the export too. Maybe there can be a key that would specify that the column wouldn't be included on exportCSV? :)

annelorraineuy avatar Jul 15 '16 20:07 annelorraineuy

hey all, I can give a props noExport on TableHeaderColumn. if noExport assigned, that column will not be exporting in the csv file

AllenFang avatar Jul 16 '16 06:07 AllenFang

HI all, released on v2.3.8 and check example

use export={false} to tell react-bootstrap-table doesn't export that column !

AllenFang avatar Jul 16 '16 07:07 AllenFang

Thanks a lot @AllenFang . It would be great to add documentation for this flag. Because some people would wonder if hidden={true} means export={false} by default.

anvk avatar Jul 18 '16 14:07 anvk

surely, I'll add in docs. Thanks your :)

AllenFang avatar Jul 19 '16 02:07 AllenFang

Hey @AllenFang , Do we have a prop we can pass to specify the filename/Spreadsheet title instead of "Table 1" ?

SmashedBird avatar Aug 17 '17 21:08 SmashedBird

@SmashedBird you can use csvFileName on BootstrapTable to specified the file name. But we can not configure the Spreadsheet title. Thanks

AllenFang avatar Aug 19 '17 03:08 AllenFang

By default when you added the flag hidden to the TableHeaderColumn it automatically set the export to that particular column to false so when you want to hide a specific column but still want to export that column you can do export = {true} in order to override what is set by default

christianbalderrama avatar Sep 15 '17 03:09 christianbalderrama

@AllenFang @SmashedBird i found one solution to configure the spreadsheet name, by adding example : document.title = 'products'; in componentdidmount event of your component or anywhere where your grid is present.

so that this title will apply to your spreadsheet.

Manu12bollineni avatar Feb 04 '21 10:02 Manu12bollineni