EasyXLS™ library allows you to import data from CVS file to Excel.
EasyXLS can be successfully used inclusively to convert large CSV files to Excel, CSV files with big volume of data with fast conversion time.
EasyXLS permits you to convert CSV to Excel file without Excel installed, without Interop or any other additional software installed.
EasyXLS also supports CSV files with specific character encoding.
The conversion is made in two steps. First, the CSV file is imported and after that, the data is exported to Excel file. Once the CSV was loaded in memory, optionally, the user can process data, add more features (like formulas, cell formatting, comments, hyperlinks, images, data validations, page setup, charts, so on) and save the file back in any Excel format like XLSX, XLSB or XLS file format.
// Create an instance of the class used to import/export Excel files
ExcelDocument workbook = new ExcelDocument();
// Import CSV file
workbook.easy_LoadCSVFile("C:\\Samples\\Excel.csv");
//Export Excel file
workbook.easy_WriteXLSXFile("C:\\Samples\\CSV to Excel.xlsx");
' Create an instance of the class used to import/export Excel filesDim workbook As New ExcelDocument
' Import CSV file
workbook.easy_LoadCSVFile("C:\Samples\Excel.csv")
' Export Excel file
workbook.easy_WriteXLSXFile("C:\Samples\CSV to Excel.xlsx")
C++// Create an instance of the class used to import/export Excel files
EasyXLS::IExcelDocumentPtr workbook;
hr = CoCreateInstance(__uuidof(EasyXLS::ExcelDocument),
NULL,
CLSCTX_ALL,
__uuidof(EasyXLS::IExcelDocument),
(void**) &workbook) ;
// Import CSV file
workbook->easy_LoadCSVFile_2("C:\\Samples\\Excel.csv");
// Export Excel file
workbook->easy_WriteXLSXFile("C:\\Samples\\CSV to Excel.xlsx");
Click here to see Continuous Code ListingC++.NET// Create an instance of the class used to import/export Excel files
ExcelDocument ^workbook = gcnew ExcelDocument();
// Import CSV file
workbook->easy_LoadCSVFile("C:\\Samples\\Excel.csv");
// Export Excel file
workbook->easy_WriteXLSXFile("C:\\Samples\\CSV to Excel.xlsx");
Click here to see Continuous Code Listing
// Create an instance of the class used to import/export Excel files
ExcelDocument workbook = new ExcelDocument();
// Import CSV file
workbook.easy_LoadCSVFile("C:\\Samples\\Excel.csv");
// Export Excel file
workbook.easy_WriteXLSXFile("C:\\Samples\\CSV to Excel.xlsx");
.NET:// Create an instance of the class used to import/export Excel files
$workbook = new COM("EasyXLS.ExcelDocument");
// Import CSV file
$workbook->easy_LoadCSVFile_2("C:\Samples\Excel.csv");
// Export Excel file
$workbook->easy_WriteXLSXFile("C:\Samples\CSV to Excel.xlsx");
Click here to see Continuous Code ListingJava:// Create an instance of the class used to import/export Excel files
$workbook = new java("EasyXLS.ExcelDocument");
// Import CSV file
$workbook->easy_LoadCSVFile("C:\Samples\Excel.csv");
// Export Excel file
$workbook->easy_WriteXLSXFile("C:\Samples\CSV to Excel.xlsx");
Click here to see Continuous Code Listing
' Create an instance of the class used to import/export Excel filesset workbook = Server.CreateObject("EasyXLS.ExcelDocument")
' Import CSV file
workbook.easy_LoadCSVFile_2("C:\Samples\Excel.csv")
' Export Excel file
workbook.easy_WriteXLSXFile("C:\Samples\CSV to Excel.xlsx")
' Create an instance of the class used to import/export Excel filesSet workbook = CreateObject("EasyXLS.ExcelDocument")
' Import CSV file
workbook.easy_LoadCSVFile_2("C:\Samples\Excel.csv")
' Export Excel file
workbook.easy_WriteXLSXFile("C:\Samples\CSV to Excel.xlsx")
' Create an instance of the class used to import/export Excel filesset workbook = CreateObject("EasyXLS.ExcelDocument")
' Import CSV file
workbook.easy_LoadCSVFile_2("C:\Samples\Excel.csv")
' Export Excel file
workbook.easy_WriteXLSXFile("C:\Samples\CSV to Excel.xlsx")
<!-- Create an instance of the class used to import/export Excel files --><cfobject type="java"class="EasyXLS.ExcelDocument"name="workbook"action="CREATE"><!-- Import CSV file --><cfset ret = workbook.easy_LoadCSVFile("C:\Samples\Excel.csv")><!-- Export Excel file --><cfset ret = workbook.easy_WriteXLSXFile("C:\Samples\CSV to Excel.xlsx")>
.NET:# Create an instance of the class used to import/export Excel files
workbook = ExcelDocument()
# Import CSV file
workbook.easy_LoadCSVFile("C:\\Samples\\Excel.csv")
# Export Excel file
workbook.easy_WriteXLSXFile("C:\\Samples\\CSV to Excel.xlsx")
Click here to see Continuous Code ListingJava:# Create an instance of the class used to import/export Excel files
workbook = gateway.jvm.ExcelDocument()
# Import CSV file
workbook.easy_LoadCSVFile("C:\\Samples\\Excel.csv")
# Export Excel file
workbook.easy_WriteXLSXFile("C:\\Samples\\CSV to Excel.xlsx")
Click here to see Continuous Code Listing
The screen shot below represents the CSV file that will be converted to Excel by the code sample above.
The screen shots below represents the converted CSV file to Excel in the above code sample.
Convert CSV file with encoding to Excel
EasyXLS allows you to convert CSV files with specific encoding into Excel files. The below source code sample shows how to achieve this goal.
// Create an instance of the class used to import/export Excel files
ExcelDocument workbook = new ExcelDocument();
// Import CSV file with specific encoding
System.IO.StreamReader streamReader =
new System.IO.StreamReader("C:\\Samples\\Excel.csv", System.Text.Encoding.Unicode);
workbook.easy_LoadCSVFile(streamReader);
// Export Excel file
workbook.easy_WriteXLSXFile("C:\\Samples\\CSV to Excel.xlsx");
' Create an instance of the class used to import/export Excel filesDim workbook As New ExcelDocument
' Import CSV file with specific encodingDim streamReader As System.IO.StreamReader =
New System.IO.StreamReader("C:\\Samples\\Excel.csv", System.Text.Encoding.Unicode)
workbook.easy_LoadCSVFile(streamReader)
' Export Excel file
workbook.easy_WriteXLSXFile("C:\\Samples\\CSV to Excel.xlsx");
C++// Create an instance of the class used to import/export Excel files
EasyXLS::IExcelDocumentPtr workbook;
hr = CoCreateInstance(__uuidof(EasyXLS::ExcelDocument),
NULL,
CLSCTX_ALL,
__uuidof(EasyXLS::IExcelDocument),
(void**) &workbook);
// Import CSV file with specific encoding
workbook->easy_LoadCSVFile_4("C:\\Samples\\Excel.csv", "Unicode");
// Export Excel file
workbook->easy_WriteXLSXFile("C:\\Samples\\CSV to Excel.xlsx");
C++.NET// Create an instance of the class used to import/export Excel files
ExcelDocument ^workbook = gcnew ExcelDocument();
// Import CSV file with specific encoding
System::IO::StreamReader ^streamReader = gcnew System::IO::StreamReader
("C:\\Samples\\Excel.csv", System::Text::Encoding::Unicode);
workbook->easy_LoadCSVFile(streamReader);
// Export Excel file
workbook->easy_WriteXLSXFile("C:\\Samples\\CSV to Excel.xlsx");
// Create an instance of the class used to import/export Excel files
ExcelDocument workbook = new ExcelDocument();
// Import CSV file with specific encoding
java.io.InputStream inputStream = new java.io.FileInputStream("C:\\Samples\\Excel.csv");
java.io.InputStreamReader inputStreamReader = new java.io.InputStreamReader(
inputStream, java.nio.charset.Charset.forName("Unicode"));
workbook.easy_LoadCSVFile(inputStreamReader);
// Export Excel file
workbook.easy_WriteXLSXFile("C:\\Samples\\CSV to Excel.xlsx");
.NET:// Create an instance of the class used to import/export Excel files
$workbook = new COM("EasyXLS.ExcelDocument");
// Import CSV file with specific encoding
$workbook->easy_LoadCSVFile_4("C:\\Samples\\Excel.csv", "Unicode");
// Export Excel file
$workbook->easy_WriteXLSXFile("C:\\Samples\\CSV to Excel.xlsx");
Java:// Create an instance of the class used to import/export Excel files
$workbook = new java("EasyXLS.ExcelDocument");
// Import CSV file with specific encoding
$workbook->easy_LoadCSVFile("C:\\Samples\\Excel.csv", "Unicode");
// Export Excel file
$workbook->easy_WriteXLSXFile("C:\\Samples\\CSV to Excel.xlsx");
' Create an instance of the class used to import/export Excel filesSet workbook = Server.CreateObject("EasyXLS.ExcelDocument")
' Import CSV file with specific encoding
workbook.easy_LoadCSVFile_4("C:\Samples\Excel.csv", "Unicode")
' Export Excel file
workbook.easy_WriteXLSXFile("C:\Samples\CSV to Excel.xlsx")
' Create an instance of the class used to import/export Excel filesSet workbook = CreateObject("EasyXLS.ExcelDocument")
' Import CSV file with specific encoding
workbook.easy_LoadCSVFile_4("C:\Samples\Excel.csv", "Unicode")
' Export Excel file
workbook.easy_WriteXLSXFile("C:\Samples\CSV to Excel.xlsx")
' Create an instance of the class used to import/export Excel filesSet workbook = CreateObject("EasyXLS.ExcelDocument")
' Import CSV file with specific encoding
workbook.easy_LoadCSVFile_4("C:\Samples\Excel.csv", "Unicode")
' Export Excel file
workbook.easy_WriteXLSXFile("C:\Samples\CSV to Excel.xlsx")
<!-- Create an instance of the class used to import/export Excel files --><cfobject type="java"class="EasyXLS.ExcelDocument"name="workbook"action="CREATE"><!-- Import CSV file with specific encoding --><cfset success = workbook.easy_LoadCSVFile("C:\Samples\Excel.csv", "Unicode")> <!-- Export Excel file --><cfset ret = workbook.easy_WriteXLSXFile("C:\Samples\CSV to Excel.xlsx")>
.NET:# Create an instance of the class used to import/export Excel files
workbook = ExcelDocument()
# Import CSV file with specific encoding
streamReader = System.IO.StreamReader("C:\\Samples\\Excel.csv",
System.Text.Encoding.Unicode);
workbook.easy_LoadCSVFile(streamReader);
# Export Excel file
workbook.easy_WriteXLSXFile("C:\\Samples\\CSV to Excel.xlsx")
Java:# Create an instance of the class used to import/export Excel files
workbook = gateway.jvm.ExcelDocument()
# Import CSV file with specific encoding
workbook.easy_LoadCSVFile("C:\\Samples\\Excel.csv", "Unicode")
# Export Excel file
workbook.easy_WriteXLSXFile("C:\\Samples\\CSV to Excel.xlsx")
Convert CSV to XLSX
EasyXLS allows you to convert CSV to Excel XLSX file. The above code samples show how to achieve this goal, by using ExcelDocument.easy_WriteXLSXFile method.
// Create an instance of the class used to import/export Excel files
ExcelDocument workbook = new ExcelDocument();
// Import CSV file
workbook.easy_LoadCSVFile("C:\\Samples\\Excel.csv");
// Export XLSB file
workbook.easy_WriteXLSBFile("C:\\Samples\\CSV to Excel.xlsb");
' Create an instance of the class used to import/export Excel filesDim workbook As New ExcelDocument
' Import CSV file
workbook.easy_LoadCSVFile("C:\\Samples\\Excel.csv")
' Export XLSB file
workbook.easy_WriteXLSBFile("C:\\Samples\\CSV to Excel.xlsb");
C++// Create an instance of the class used to import/export Excel files
EasyXLS::IExcelDocumentPtr workbook;
hr = CoCreateInstance(__uuidof(EasyXLS::ExcelDocument),
NULL,
CLSCTX_ALL,
__uuidof(EasyXLS::IExcelDocument),
(void**) &workbook);
// Import CSV file
workbook->easy_LoadCSVFile("C:\\Samples\\Excel.csv");
// Export XLSB file
workbook->easy_WriteXLSBFile("C:\\Samples\\CSV to Excel.xlsb");
C++.NET// Create an instance of the class used to import/export Excel files
ExcelDocument ^workbook = gcnew ExcelDocument();
// Import CSV file
workbook->easy_LoadCSVFile("C:\\Samples\\Excel.csv");
// Export XLSB file
workbook->easy_WriteXLSBFile("C:\\Samples\\CSV to Excel.xlsb");
// Create an instance of the class used to import/export Excel files
ExcelDocument workbook = new ExcelDocument();
// Import CSV file
workbook.easy_LoadCSVFile("C:\\Samples\\Excel.csv");
// Export XLSB file
workbook.easy_WriteXLSBFile("C:\\Samples\\CSV to Excel.xlsb");
.NET:// Create an instance of the class used to import/export Excel files
$workbook = new COM("EasyXLS.ExcelDocument");
// Import CSV file
$workbook->easy_LoadCSVFile("C:\\Samples\\Excel.csv");
// Export XLSB file
$workbook->easy_WriteXLSBFile("C:\\Samples\\CSV to Excel.xlsb");
Java:// Create an instance of the class used to import/export Excel files
$workbook = new java("EasyXLS.ExcelDocument");
// Import CSV file
$workbook->easy_LoadCSVFile("C:\\Samples\\Excel.csv");
// Export XLSB file
$workbook->easy_WriteXLSBFile("C:\\Samples\\CSV to Excel.xlsb");
' Create an instance of the class used to import/export Excel filesSet workbook = Server.CreateObject("EasyXLS.ExcelDocument")
' Import CSV file
workbook.easy_LoadCSVFile("C:\Samples\Excel.csv")
' Export XLSB file
workbook.easy_WriteXLSBFile("C:\Samples\CSV to Excel.xlsb")
' Create an instance of the class used to import/export Excel filesSet workbook = CreateObject("EasyXLS.ExcelDocument")
' Import CSV file
workbook.easy_LoadCSVFile("C:\Samples\Excel.csv")
' Export XLSB file
workbook.easy_WriteXLSBFile("C:\Samples\CSV to Excel.xlsb")
' Create an instance of the class used to import/export Excel filesSet workbook = CreateObject("EasyXLS.ExcelDocument")
' Import CSV file
workbook.easy_LoadCSVFile("C:\Samples\Excel.csv")
' Export XLSB file
workbook.easy_WriteXLSBFile("C:\Samples\CSV to Excel.xlsb")
<!-- Create an instance of the class used to import/export Excel files --><cfobject type="java"class="EasyXLS.ExcelDocument"name="workbook"action="CREATE"><!-- Import CSV file --><cfset success = workbook.easy_LoadCSVFile("C:\Samples\Excel.csv")><!-- Export XLSB file --><cfset ret = workbook.easy_WriteXLSBFile("C:\Samples\CSV to Excel.xlsb")>
.NET:# Create an instance of the class used to import/export Excel files
workbook = ExcelDocument()
# Import CSV file
workbook.easy_LoadCSVFile("C:\\Samples\\Excel.csv");
# Export XLSB file
workbook.easy_WriteXLSBFile("C:\\Samples\\CSV to Excel.xlsb")
Java:# Create an instance of the class used to import/export Excel files
workbook = gateway.jvm.ExcelDocument()
# Import CSV file
workbook.easy_LoadCSVFile("C:\\Samples\\Excel.csv")
# Export XLSB file
workbook.easy_WriteXLSBFile("C:\\Samples\\CSV to Excel.xlsb")
// Create an instance of the class used to import/export Excel files
ExcelDocument workbook = new ExcelDocument();
// Import CSV file
workbook.easy_LoadCSVFile("C:\\Samples\\Excel.csv");
// Export XLS file
workbook.easy_WriteXLSFile("C:\\Samples\\CSV to Excel.xls");
' Create an instance of the class used to import/export Excel filesDim workbook As New ExcelDocument
' Import CSV file
workbook.easy_LoadCSVFile("C:\\Samples\\Excel.csv")
' Export XLS file
workbook.easy_WriteXLSFile("C:\\Samples\\CSV to Excel.xls");
C++// Create an instance of the class used to import/export Excel files
EasyXLS::IExcelDocumentPtr workbook;
hr = CoCreateInstance(__uuidof(EasyXLS::ExcelDocument),
NULL,
CLSCTX_ALL,
__uuidof(EasyXLS::IExcelDocument),
(void**) &workbook);
// Import CSV file
workbook->easy_LoadCSVFile("C:\\Samples\\Excel.csv");
// Export XLS file
workbook->easy_WriteXLSFile("C:\\Samples\\CSV to Excel.xls");
C++.NET// Create an instance of the class used to import/export Excel files
ExcelDocument ^workbook = gcnew ExcelDocument();
// Import CSV file
workbook->easy_LoadCSVFile("C:\\Samples\\Excel.csv");
// Export XLS file
workbook->easy_WriteXLSFile("C:\\Samples\\CSV to Excel.xls");
// Create an instance of the class used to import/export Excel files
ExcelDocument workbook = new ExcelDocument();
// Import CSV file
workbook.easy_LoadCSVFile("C:\\Samples\\Excel.csv");
// Export XLS file
workbook.easy_WriteXLSFile("C:\\Samples\\CSV to Excel.xls");
.NET:// Create an instance of the class used to import/export Excel files
$workbook = new COM("EasyXLS.ExcelDocument");
// Import CSV file
$workbook->easy_LoadCSVFile("C:\\Samples\\Excel.csv");
// Export XLS file
$workbook->easy_WriteXLSFile("C:\\Samples\\CSV to Excel.xls");
Java:// Create an instance of the class used to import/export Excel files
$workbook = new java("EasyXLS.ExcelDocument");
// Import CSV file
$workbook->easy_LoadCSVFile("C:\\Samples\\Excel.csv");
// Export XLS file
$workbook->easy_WriteXLSFile("C:\\Samples\\CSV to Excel.xls");
' Create an instance of the class used to import/export Excel filesSet workbook = Server.CreateObject("EasyXLS.ExcelDocument")
' Import CSV file
workbook.easy_LoadCSVFile("C:\Samples\Excel.csv")
' Export XLS file
workbook.easy_WriteXLSFile("C:\Samples\CSV to Excel.xls")
' Create an instance of the class used to import/export Excel filesSet workbook = CreateObject("EasyXLS.ExcelDocument")
' Import CSV file
workbook.easy_LoadCSVFile("C:\Samples\Excel.csv")
' Export XLS file
workbook.easy_WriteXLSFile("C:\Samples\CSV to Excel.xls")
' Create an instance of the class used to import/export Excel filesSet workbook = CreateObject("EasyXLS.ExcelDocument")
' Import CSV file
workbook.easy_LoadCSVFile("C:\Samples\Excel.csv")
' Export XLS file
workbook.easy_WriteXLSFile("C:\Samples\CSV to Excel.xls")
<!-- Create an instance of the class used to import/export Excel files --><cfobject type="java"class="EasyXLS.ExcelDocument"name="workbook"action="CREATE"><!-- Import CSV file --><cfset success = workbook.easy_LoadCSVFile("C:\Samples\Excel.csv")><!-- Export XLS file --><cfset ret = workbook.easy_WriteXLSFile("C:\Samples\CSV to Excel.xls")>
.NET:# Create an instance of the class used to import/export Excel files
workbook = ExcelDocument()
# Import CSV file
workbook.easy_LoadCSVFile("C:\\Samples\\Excel.csv");
# Export XLS file
workbook.easy_WriteXLSFile("C:\\Samples\\CSV to Excel.xls")
Java:# Create an instance of the class used to import/export Excel files
workbook = gateway.jvm.ExcelDocument()
# Import CSV file
workbook.easy_LoadCSVFile("C:\\Samples\\Excel.csv")
# Export XLS file
workbook.easy_WriteXLSFile("C:\\Samples\\CSV to Excel.xls")