Skip to content

Instantly share code, notes, and snippets.

@farhan-raza
Created November 17, 2020 23:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save farhan-raza/07cc9a90227fd8684e4265115ef0cb5f to your computer and use it in GitHub Desktop.
Save farhan-raza/07cc9a90227fd8684e4265115ef0cb5f to your computer and use it in GitHub Desktop.
Convert CSV to Excel or XLSX/XLS to CSV with C# VB.NET
// Opening CSV Files
// Creating CSV LoadOptions object
LoadOptions loadOptions = new LoadOptions(LoadFormat.CSV);
// Creating an Workbook object with CSV file path and the loadOptions
// object
Workbook workbook = new Workbook(dataDir + "Sample.csv", loadOptions);
workbook.Save(dataDir + "CSVtoExcel.xlsx", SaveFormat.Xlsx);
// Load the input Excel file
Workbook workbook = new Workbook(dataDir + "CSVtoExcel.xlsx");
// Save output CSV file
workbook.Save(dataDir + "ExcelToCSV.csv", SaveFormat.CSV);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment