In the tablename_init hook, add:
$CSVFields = $options->QueryFieldsCSV;
$colIndex = 0;
$colNumber = 0;
// loop through all fields
foreach ($CSVFields as $field => $title) {
// Update column header
if (($options->ColNumber[$colIndex] – 1) == $colNumber) {
$newCSVFields[$field] = $options->ColCaption[$colIndex];
$colIndex++;
}
else {
$newCSVFields[$field] = $title;
}
$colNumber++;
}
// now apply the modified fields
$options->QueryFieldsCSV = $newCSVFields;