static void Main(string[] args) { string csvFilePath = @"D:\sample.csv"; string excelFilePath = @"D:\sample.xls"; string worksheetsName = "TEST"; bool firstRowIsHeader = false; var excelTextFormat = new ExcelTextFormat(); excelTextFormat.Delimiter = ','; excelTextFormat.EOL = "\r"; var excelFileInfo = new FileInfo(excelFilePath); var csvFileInfo = new FileInfo(csvFilePath); using (ExcelPackage package = new ExcelPackage(excelFileInfo)) { ExcelWorksheet worksheet = package.Workbook.Worksheets.Add(worksheetsName); worksheet.Cells["A1"].LoadFromText(csvFileInfo, excelTextFormat, OfficeOpenXml.Table.TableStyles.Medium25, firstRowIsHeader); package.Save(); } Console.WriteLine("Converted!"); Console.ReadLine(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)