Possible bug in CSV creation

I have the following line of code in my application.

excel.Save( errorCategory.ToString() + “.xls”, SaveType.OpenInExcel, FileFormatType.Excel97, response );

I made a change to it recently to try sending a CSV to the user instead of a native Excel file. The resulting line of code was:

excel.Save( errorCategory.ToString() + “.csv”, SaveType.OpenInExcel, FileFormatType.CSV, response );

The problem that resulted can be seen in the attached zip. As you can see in Class.xls, columns B and C have column headers in row 1 but the cells below row 1 for those two columns are empty.

In Class.csv, the first non-header row is:

Warning,CRF Class Subject Name longer than 20 characters…

Notice there is only one comma between Warning (column A) and “CRF Class…” (column D). It should be:

Warning,CRF Class Subject Name longer than 20 characters

Thanks for your report. I will fix it in next version.

@nweait,
Aspose.Cells has replaced Aspose.Excel that is no more actively developed now. This new product contains many advanced features to export Excel file to CSV. A simple program to demonstrate this feature is available here:

TxtSaveOptions opts = new TxtSaveOptions()
{
    Separator = ',',
};
Workbook workbook = new Workbook("sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
workbook.Save("sample_out.csv",opts);

You may explore this TxtLoadOptions in the following document:
TxtSaveOptions Class

Similarly, note that you can convert JSON to CSV and vice versa as desscribed in the following document:
Convert JSON to CSV
Convert CSV to JSON

Also consider following articles for more information about working with CSV.
Trim Leading Blank Rows and Columns while exporting spreadsheets to CSV format
Keep Separators for Blank Rows while exporting spreadsheets to CSV format

To run this sample code, download the latest free trial version here:
Aspose.Cells for .NET (Latest Version)

Download a runnable solution here to test a variety of features of this product without writing any code.