how to convert csv file to excel file using c# RRS feed

  • Question

  • Can somebody help me with coding thing for this , tried many things but it's not working
    Wednesday, June 5, 2019 6:32 AM

All replies

  • If you have Microsoft Visual Studio Tools for Office (VSTO), add a reference to Microsoft.Office.Interop.Excel try using code like

    Application excel = new Application();
    Workbook wb = excel.Workbooks.Open("C:\File.csv");

     wb.SaveAs(strFullFilePathNoExt, Excel.XlFileFormat.xlOpenXMLWorkbook, Missing.Value,
        Missing.Value, false, false, Excel.XlSaveAsAccessMode.xlNoChange, 
        Excel.XlSaveConflictResolution.xlUserResolution, true, 
        Missing.Value, Missing.Value, Missing.Value);
    Wednesday, June 5, 2019 12:46 PM