how to swap columns/hide in a grid for export to excel

Hi,
I use the code below to export my Grid to Excel and it work fine

 myGrid.toExcel('codebase/grid-excel-php/generate.php');

and I want hide some columms during Excel Export and swap the order of some columns. Is it possible ?

Example in myGrid
“Column1,Column2,Column3”
In Export Excel
“Column3,Column2”

Thx

You can use setColumnHidden api to hide column before export call, and show the column after it. Hidden columns do not included in the export result.

Thanks Stanislav,
I’ll try this method to simulate the column swap.
Best regards.