I have a next code for converting excel file to csv file:
Microsoft.Office.Interop.Excel.Application reportExcel = new Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Interop.Excel.Workbooks reportBooks = null;
Microsoft.Office.Interop.Excel.Workbook reportBook = null;
Microsoft.Office.Interop.Excel.Sheets reportSheets = null;
Microsoft.Office.Interop.Excel._Worksheet reportSheet = null;
try
{
reportBooks = reportExcel.Workbooks;
reportBook = reportBooks.Open(excelFilePath);
reportSheets = reportBook.Sheets;
reportSheet = reportSheets.get_Item(1);
if (File.Exists(csvtempFile))
{
File.Delete(csvtempFile);
}
reportBook.SaveAs(csvtempFile, Microsoft.Office.Interop.Excel.XlFileFormat.xlCSVWindows, Type.Missing, Type.Missing, false, false);
...
}
catch (Exception ex)
{
...
}
finally
{
...
}
I get next text in csv file:
...
"Some strings","309,145","4,964,398",,"1,194,780",,
...
As you see numbers contain an extra comma. Please tell me how to remove extra comma for getting next value:
"Some strings","309,145","4964,398",,"1194,780",,