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

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


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

Example in myGrid
In Export Excel


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.