Title: Export CSV
Last modified: June 5, 2020

---

# Export CSV

 *  Resolved [loristictok](https://wordpress.org/support/users/loristictok/)
 * (@loristictok)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/export-csv-13/)
 * for those who need to export in CSV the generated result table, this javascript/
   jQuery snippet does the trick:
    I personally use “CUSTOM CSS AND JS” plugin with
   this code set to Admin pages
 *     ```
       jQuery(document).ready(function( $ ){
         jQuery.getScript('https://cdn.jsdelivr.net/npm/table2csv@1.1.4/src/table2csv.min.js', function () {
           if ($(".ELISQLREPORTS-table").length)
             {
           $('table.ELISQLREPORTS-table').each(function () {
               var $table = $(this);
               var $title = $(".ELISQLREPORTS-Report-Name")[0].textContent;
               var $button = $("<button type='button'>");
               $button.text("Export to CSV");
               $button.insertBefore($table);		
               $button.click(function () {          	
                   $table.table2csv('download', { 'filename': $title + ".csv" });
               });
           });
       	}
         });
       });
       /*
       https://github.com/OmbraDiFenice/table2csv
       */
       ```
   
    -  This topic was modified 5 years, 11 months ago by [loristictok](https://wordpress.org/support/users/loristictok/).

Viewing 1 replies (of 1 total)

 *  [rob66bnu](https://wordpress.org/support/users/rob66bnu/)
 * (@rob66bnu)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/export-csv-13/#post-13128499)
 * Thanks for sharing this. It’s a great feature that should be in the core plug-
   in.
 * For pages that have multiple reports (and I have several), I found it necessary
   to change the line:
    var $title = $(“.ELISQLREPORTS-Report-Name”)[0].textContent;
   to: var $title = $(this).siblings(“.ELISQLREPORTS-Report-Name”)[0].textContent;
 * so that exported file name for every report matches its own report name (instead
   of them all taking the name from the first report on the page).

Viewing 1 replies (of 1 total)

The topic ‘Export CSV’ is closed to new replies.

 * ![](https://ps.w.org/elisqlreports/assets/icon-256x256.png?rev=1231385)
 * [EZ SQL Reports Shortcode Widget and DB Backup](https://wordpress.org/plugins/elisqlreports/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/elisqlreports/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/elisqlreports/)
 * [Active Topics](https://wordpress.org/support/plugin/elisqlreports/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/elisqlreports/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/elisqlreports/reviews/)

## Tags

 * [csv](https://wordpress.org/support/topic-tag/csv/)

 * 1 reply
 * 2 participants
 * Last reply from: [rob66bnu](https://wordpress.org/support/users/rob66bnu/)
 * Last activity: [5 years, 10 months ago](https://wordpress.org/support/topic/export-csv-13/#post-13128499)
 * Status: resolved