I need to convert a csv-file to xlsx. I want to use the interop functionality.
The csv file is semicolon separated, but the open function ignores the set delimiter.
Here's my code:
Excel.Application app = new Excel.Application();
app.Visible = true;
Excel.Workbooks workbooks = app.Workbooks;
Excel.Workbook wb = app.Workbooks.Open(sourceFile,
Type.Missing,
Type.Missing,
Excel.XlFileFormat.xlCSV, // Format
Type.Missing,
Type.Missing,
Type.Missing,
Type.Missing,
";", // Delimiter
Type.Missing,
Type.Missing,
Type.Missing,
Type.Missing,
Type.Missing,
Type.Missing);
workbooks[1].SaveAs(newXLSXPath, Excel.XlFileFormat.xlOpenXMLWorkbook);
workbooks.Close();
When I open the new xlsx file, I can see that the csv file was opened using ',' as separator.
What's wrong here?