Title: Export visible columns only
Last modified: November 2, 2018

---

# Export visible columns only

 *  Resolved [baffo2000](https://wordpress.org/support/users/baffo2000/)
 * (@baffo2000)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/export-visible-columns-only/)
 * Is there a Tablepress custom command available so that buttons export only the
   visible columns to PDF, Excel, etc?
 * I know it can be done with Datatables (as [this page](https://datatables.net/extensions/buttons/examples/html5/columns.html)
   shows) but I am not sure if or how I can use this JS code in the custom commands
   box of my Tablepress tables.
 * Apologies if this has been posted before, but I have not been able to find the
   information after a lot of searching.

Viewing 9 replies - 1 through 9 (of 9 total)

 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/export-visible-columns-only/#post-10841868)
 * Hi,
 * thanks for your post, and sorry for the trouble.
 * Yes, this should work. First, you could drag the “Custom Commands” box a bit 
   bigger and then add something like what you see on that page:
 *     ```
       "buttons": [
           {
               "extend": "copyHtml5",
               "exportOptions": {
                   "columns": [ 0, ":visible" ]
               }
           },
           {
               "extend": "excelHtml5",
               "exportOptions": {
                   "columns": ":visible"
               }
           },
           {
               "extend": "pdfHtml5",
               "exportOptions": {
                   "columns": [ 0, 1, 2, 5 ]
               }
           },
           "colvis"
       ]
       ```
   
 * (I recommend to write proper JSON code, with `"` around the text strings.)
 * Regards,
    Tobias
 *  Thread Starter [baffo2000](https://wordpress.org/support/users/baffo2000/)
 * (@baffo2000)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/export-visible-columns-only/#post-10860776)
 * Perfect – this does the exactly the job I wanted. Thank you very much.
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/export-visible-columns-only/#post-10860778)
 * Hi,
 * no problem, you are very welcome! 🙂 Good to hear that this helped!
 * Best wishes,
    Tobias
 * P.S.: In case you haven’t, please [rate TablePress](https://wordpress.org/support/plugin/tablepress/reviews/#new-post)
   here in the plugin directory. Thanks!
 *  [sagirish](https://wordpress.org/support/users/sagirish/)
 * (@sagirish)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/export-visible-columns-only/#post-11206405)
 * Hi,
 * I want only columns 1,2,3,4 to be visible and 1st column to make invisible in
   the pdf. I wrote the code as below but it made my search bar and pdf button to
   disappear.
    can you please suggest if i made anything wrong. “buttons”: [
 *  {
    “extend”: “pdfHtml5”, “exportOptions”: { “columns”: [ 1,2,3,4 ] } } ]
 * Thanks
    Sugandha
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/export-visible-columns-only/#post-11206837)
 * Hi Sugandha,
 * Can you please post a link to the page with the table where this problem happens,
   so that I can take a direct look? Thanks!
 * Regards,
    Tobias
 *  [sagirish](https://wordpress.org/support/users/sagirish/)
 * (@sagirish)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/export-visible-columns-only/#post-11206968)
 * [Employee Directory](http://10.161.84.7/intranet/test-page/)
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/export-visible-columns-only/#post-11207463)
 * Hi,
 * I’m afraid that I can not access that URL, because it’s in the private IP address
   sector :-/ It’s probably only reachable from your local intranet.
 * Regards,
    Tobias
 *  [sagirish](https://wordpress.org/support/users/sagirish/)
 * (@sagirish)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/export-visible-columns-only/#post-11207486)
 * I did fixed the code. Thanks
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/export-visible-columns-only/#post-11207516)
 * Hi,
 * great, good to hear that it’s working now!
 * Best wishes,
    Tobias

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Export visible columns only’ is closed to new replies.

 * ![](https://ps.w.org/tablepress/assets/icon.svg?rev=3192944)
 * [TablePress - Tables in WordPress made easy](https://wordpress.org/plugins/tablepress/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/tablepress/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/tablepress/)
 * [Active Topics](https://wordpress.org/support/plugin/tablepress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/tablepress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/tablepress/reviews/)

 * 9 replies
 * 3 participants
 * Last reply from: [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * Last activity: [7 years, 5 months ago](https://wordpress.org/support/topic/export-visible-columns-only/#post-11207516)
 * Status: resolved