I have a table and I use DataTables, I'm using the native export functionality and give a hide in the columns my code looks something like this:
"buttons":
[
'copy', 'csv', 'excel', 'pdf', 'print',
{
extend: 'colvis',
text: '+ Colunas'
}
],
"columnDefs":
[
{
"targets": [ 7,8,9,10,11,12,13,14,15,16,17,18,19,20,21 ],
"visible": false,
}
]