Creating new sheets in csv file
I am trying to write a data in csv file as below
Code:
l<<"StatusFrame1"<<"PORstat"<<"name";
{
out<<l.at(0).toStdString().c_str()<<","<<l.at(1).toStdString().c_str()<<"\n";
out<<l.at(0).toStdString().c_str()<<","<<l.at(1).toStdString().c_str()<<"\n";
}
file.close();
The above code create a csv file(with one sheet) and successfully write the data on that sheet
But I want one more new sheet to be created or added in same csv file(like how we have number of sheets in one excel file)
So please let me know how can I create two or more sheets in one csv file.
Re: Creating new sheets in csv file
A CSV file is a flat ASCII file. There is no concept of "sheets" in such a file. You are obviously confused because Excel can export a single page of a workbook to a CSV format file, but once it is in that format there is no connection between that and a "Sheet" as defined by Excel. It's an ASCII file, and that's all it is.
Re: Creating new sheets in csv file
Quote:
Originally Posted by
d_stranz
A CSV file is a flat ASCII file. There is no concept of "sheets" in such a file.
Exactly.
However, if Excel can interpret some form of markup in such files to import different sections into different sheets, then this might still work.
But then this would have to be asked for on an Excel forum, since it is Excel specific.
Though it could be easily tested by having Excel export to CSV and import into a new document. If the sheets are still separated, then the file should contain the necessary markup, if they are not, then Excel can't do that.
Cheers,
_
Re: Creating new sheets in csv file
I have not seen any way in Excel to export more than a single sheet to any ASCII format, and indeed, the CSV files created contain only the printable contents of the cells in the exported sheet, nothing more (like meta-information on the workbook, sheets, etc.)