Invalid csv Files

I often write data into csv files as plain text: it allows people to load the data in excel and makes it easy to parse the data into Python.

I generated the following header as part of some data processing in c++:

ofstream WriteBasinData;
stringstream ss3;
ss3 << path << prefix << "_E_R_Star_Basin_" << BasinOrder << "_Data.csv";       ;

//write the header
WriteBasinData << "ID,LH,CHT,Relief,Slope,Area,Count" << endl;

When I went to the load the file in excel to check the data was being written correctly, it presented an error, stating that the file was not csv but a sylk file, but when it tried to open it as a sylk file it had errors and could not be loaded.

It turns out that starting a csv header row with ID causes excel to fail on import, the official fix is to rename the header to get around this issue. So I have done that, but this highlights how glad I am to not have to use excel for any serious analysis.