I have it not very sharp right now, but in one of my projects I did something like ;
- convert file to string (stringfromfile , community commons)
- adjust the headers directly in the string (with some logic)
- recreate the csv (i thought with some actions from one of the modules, could be csv or other export/import modules,)
I can look it up for you if you can't figure it out
How did you change the csv file?