Exporting CSV by number of rows (split CSV)

Exporting CSV by number of rows (split CSV)

alannahalannah Posts: 2Questions: 2Answers: 0

Hi,

I would like to split my datatable results into multiple CSV files. Currently I'm exporting all my results into one CSV file, but I would like to limit the export amount to 10 rows per CSV file. So if there were 30 results, I'd get 3 CSV files, 10 results per file. Is this possible? I would appreciate any help!

Thank you!

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,480Questions: 1Answers: 10,467 Site admin
    Answer ✓

    There isn't a build in way to do it, but it is perfectly possible with a little programming. Use the buttons.exportData() method to get the data from the DataTable (which is what Buttons does for its export) then use $.fn.dataTable.fileSave() to save the file when you've created the CSV structure.

    Allan

This discussion has been closed.