change col title only for some columns when export

change col title only for some columns when export

m75sam75sa Posts: 132Questions: 30Answers: 0
edited March 2022 in DataTables

Hi,
i know that there are several posts on the forum about this but no result i had sorry.
I have a table with 3 columns. I would like to change only the second column title (for example) when i export via 'export button'

Any ideas?

This question has an accepted answers - jump to answer

Answers

  • rf1234rf1234 Posts: 2,991Questions: 87Answers: 421
    edited March 2022 Answer ✓
    buttons: [
    { extend: "excel",
        customize: function( xlsx ) {
            var sheet = xlsx.xl.worksheets['sheet1.xml'];
            $('row:eq(0) c[r^="B"] t', sheet).text("newColumnName");
        }
    } ]
    
Sign In or Register to comment.