Does XlsIO support CSV file format?
Yes, XlsIO supports opening and saving of CSV files.
Syncfusion Excel (XlsIO) library is a .NET Excel library used to create, read, and edit Excel documents. Also, converts Excel documents to PDF files. Using this library, you can open and save files in CSV file format.
By default, CSV files are opened in Excel 2003 format. If the file has more than 65536 rows of data, it is recommended to set the default version to Excel 2007 or above.
Steps to open and save files in CSV file format, programmatically:
Step 1: Create a new C# console application project.
Create a new C# console application
Step 2: Install the Syncfusion.XlsIO.WinForms NuGet package as reference to your .NET Framework application from NuGet.org.
Install NuGet package
Step 3: Include the following namespace in the Program.cs file.
C#
using Syncfusion.XlsIO;
VB.NET
Imports Syncfusion.XlsIO
Step 4: Use the following code snippet to open and save files in CSV file format using XlsIO in C#, VB.NET.
C#
//Create Excel engine using (ExcelEngine excelEngine = new ExcelEngine()) { //Instantiate the application object IApplication application = excelEngine.Excel; //Set default application verion as Excel 2013 application.DefaultVersion = ExcelVersion.Excel2013; //Open CSV file IWorkbook workbook = application.Workbooks.Open("CSVFile.csv"); //Save CSV file workbook.SaveAs("Output.csv", ","); }
VB.NET
'Create Excel engine Using excelEngine As ExcelEngine = New ExcelEngine() 'Instantiate the application object Dim application As IApplication = excelEngine.Excel 'Set default application verion as Excel 2013 application.DefaultVersion = ExcelVersion.Excel2013 'Open CSV file Dim workbook As IWorkbook = application.Workbooks.Open("CSVFile.csv") 'Save CSV file workbook.SaveAs("Output.csv", ",") End Using
A complete Windows Forms working example of how to open and save CSV file using XlsIO in C# and VB.NET can be downloaded from Open-And-Save-CSV-File.zip.
By executing the program, you will get the output as below.
Output Excel document
Refer here to explore the rich set of Syncfusion Excel (XlsIO) library features.
See Also:
Convert Excel file to CSV in C#, VB.NET
How to convert a CSV file into Excel document using XlsIO in PowerShell?
How to export Excel data to CSV file?
How to get hyperlink url from the CSV file using XlsIO
How to generate CSV file for other languages?
Starting with v16.2.0.x, if you reference Syncfusion assemblies from trial setup or from the NuGet feed, include a license key in your projects. Refer the link to learn about generating and registering Syncfusion license key in your application to use the components without trial message.