EasyXLS™ library allows you to import data from HTML file to Excel.
EasyXLS can be successfully used inclusively to convert large HTML files to Excel, HTML files with big volume of data with fast conversion time.
The following actions are performed during the conversion:
- Import text data from HTML file to Excel - Convert HTML table to Excel file - Import HTML formatting and convert to a best match to Excel cell formatting - Import image from HTML file to Excel sheet - Import hyperlink from HTML file to Excel cell
EasyXLS permits you to convert HTML to Excel file without Excel installed, without Interop or any other additional software installed.
EasyXLS also supports HTML files with specific character encoding.
The conversion is made in two steps. First, the HTML file is imported and after that, the data is exported to Excel file. Once the HTML 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, and 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 HTML file
workbook.easy_LoadHTMLFile("C:\\Samples\\file.html");
// Export Excel file
workbook.easy_WriteXLSXFile("C:\\Samples\\HTML to Excel.xlsx");
' Create an instance of the class used to import/export Excel filesDim workbook As New ExcelDocument
' Import HTML file
workbook.easy_LoadHTMLFile("C:\Samples\file.html")
' Export Excel file
workbook.easy_WriteXLSXFile("C:\Samples\HTML 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 HTML file
workbook->easy_LoadHTMLFile_2("C:\\Samples\\file.html");
// Export Excel file
workbook->easy_WriteXLSXFile("C:\\Samples\\HTML 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 HTML file
workbook->easy_LoadHTMLFile("C:\\Samples\\file.html");
// Export Excel file
workbook->easy_WriteXLSXFile("C:\\Samples\\HTML 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 HTML file
workbook.easy_LoadHTMLFile("C:\\Samples\\file.html");
// Export Excel file
workbook.easy_WriteXLSXFile("C:\\Samples\\HTML to Excel.xlsx");
.NET:// Create an instance of the class used to import/export Excel files
$workbook = new COM("EasyXLS.ExcelDocument");
// Import HTML file
$workbook->easy_LoadHTMLFile_2("C:\Samples\file.html");
// Export Excel file
$workbook->easy_WriteXLSXFile("C:\Samples\HTML 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 HTML file
$workbook->easy_LoadHTMLFile("C:\Samples\file.html");
// Export Excel file
$workbook->easy_WriteXLSXFile("C:\Samples\HTML 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 HTML file
workbook.easy_LoadHTMLFile_2("C:\Samples\file.html")
' Export Excel file
workbook.easy_WriteXLSXFile("C:\Samples\HTML to Excel.xlsx")
' Create an instance of the class used to import/export Excel filesSet workbook = CreateObject("EasyXLS.ExcelDocument")
' Import HTML file
workbook.easy_LoadHTMLFile_2("C:\Samples\file.html")
' Export Excel file
workbook.easy_WriteXLSXFile("C:\Samples\HTML to Excel.xlsx")
' Create an instance of the class used to import/export Excel filesset workbook = CreateObject("EasyXLS.ExcelDocument")
' Import HTML file
workbook.easy_LoadHTMLFile_2("C:\Samples\file.html")
' Export Excel file
workbook.easy_WriteXLSXFile("C:\Samples\HTML 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 HTML file --><cfset ret = workbook.easy_LoadHTMLFile("C:\Samples\file.html")><!-- Export Excel file --><cfset ret = workbook.easy_WriteXLSXFile("C:\Samples\HTML to Excel.xlsx")>
.NET:# Create an instance of the class used to import/export Excel files
workbook = ExcelDocument()
# Import HTML file
workbook.easy_LoadHTMLFile("C:\\Samples\\file.html")
# Export Excel file
workbook.easy_WriteXLSXFile("C:\\Samples\\HTML 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 HTML file
workbook.easy_LoadHTMLFile("C:\\Samples\\file.html")
# Export Excel file
workbook.easy_WriteXLSXFile("C:\\Samples\\HTML to Excel.xlsx")
Click here to see Continuous Code Listing
The screen shot below represents the HTML file that will be converted to Excel by the code sample above.
The screen shots below represents the converted HTML file to Excel in the above code sample.
Convert HTML file with encoding to Excel
EasyXLS allows you to convert HTML 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 HTML file with specific encoding
System.IO.StreamReader streamReader = new System.IO.StreamReader
("C:\\Samples\\File.html", System.Text.Encoding.Unicode);
workbook.easy_LoadHTMLFile(streamReader);
// Export Excel file
workbook.easy_WriteXLSXFile("C:\\Samples\\HTML to Excel.xlsx");
' Create an instance of the class used to import/export Excel filesDim workbook As New ExcelDocument
' Import HTML file with specific encodingDim streamReader As System.IO.StreamReader =
New System.IO.StreamReader("C:\\Samples\\File.html", System.Text.Encoding.Unicode)
workbook.easy_LoadHTMLFile(streamReader)
// Export Excel file
workbook.easy_WriteXLSXFile("C:\\Samples\\HTML 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 HTML file with specific encoding
workbook->easy_LoadHTMLFile_4("C:\\Samples\\File.html", "Unicode");
// Export Excel file
workbook->easy_WriteXLSXFile("C:\\Samples\\HTML to Excel.xlsx");
C++.NET// Create an instance of the class used to import/export Excel files
ExcelDocument ^workbook = gcnew ExcelDocument();
// Import HTML file with specific encoding
System::IO::StreamReader ^streamReader = gcnew System::IO::StreamReader
("C:\\Samples\\File.html", System::Text::Encoding::Unicode);
workbook->easy_LoadHTMLFile(streamReader);
// Export Excel file
workbook->easy_WriteXLSXFile("C:\\Samples\\HTML to Excel.xlsx");
// Create an instance of the class used to import/export Excel files
ExcelDocument workbook = new ExcelDocument();
// Import HTML file with specific encoding
java.io.InputStream inputStream = new java.io.FileInputStream("C:\\Samples\\File.html");
java.io.InputStreamReader inputStreamReader = new java.io.InputStreamReader(
inputStream, java.nio.charset.Charset.forName("Unicode"));
workbook.easy_LoadHTMLFile(inputStreamReader);
// Export Excel file
workbook.easy_WriteXLSXFile("C:\\Samples\\HTML to Excel.xlsx");
.NET:// Create an instance of the class used to import/export Excel files
$workbook = new COM("EasyXLS.ExcelDocument");
// Import HTML file with specific encoding
$workbook->easy_LoadHTMLFile_4("C:\\Samples\\File.html", "Unicode");
// Export Excel file
$workbook->easy_WriteXLSXFile("C:\Samples\HTML to Excel.xlsx");
Java:// Create an instance of the class used to import/export Excel files
$workbook = new java("EasyXLS.ExcelDocument");
// Import HTML file with specific encoding
$workbook->easy_LoadHTMLFile("C:\\Samples\\File.html", "Unicode");
// Export Excel file
$workbook->easy_WriteXLSXFile("C:\Samples\HTML to Excel.xlsx");
' Create an instance of the class used to import/export Excel filesSet workbook = Server.CreateObject("EasyXLS.ExcelDocument")
' Import HTML file with specific encoding
workbook.easy_LoadHTMLFile_4 "C:\Samples\File.html", "Unicode"' Export Excel file
workbook.easy_WriteXLSXFile("C:\Samples\HTML to Excel.xlsx")
' Create an instance of the class used to import/export Excel filesSet workbook = CreateObject("EasyXLS.ExcelDocument")
' Import HTML file with specific encoding
workbook.easy_LoadHTMLFile_4 "C:\Samples\File.html", "Unicode"' Export Excel file
workbook.easy_WriteXLSXFile("C:\Samples\HTML to Excel.xlsx")
' Create an instance of the class used to import/export Excel filesSet workbook = CreateObject("EasyXLS.ExcelDocument")
' Import HTML file with specific encoding
workbook.easy_LoadHTMLFile_4 "C:\Samples\File.html", "Unicode"' Export Excel file
workbook.easy_WriteXLSXFile("C:\Samples\HTML 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 HTML file with specific encoding --><cfset success = workbook.easy_LoadHTMLFile("C:\Samples\File.html", "Unicode")><!-- Export Excel file --><cfset ret = workbook.easy_WriteXLSXFile("C:\Samples\HTML to Excel.xlsx")>
.NET:# Create an instance of the class used to import/export Excel files
workbook = ExcelDocument()
# Import HTML file with specific encoding
streamReader = System.IO.StreamReader("C:\\Samples\\File.html",
System.Text.Encoding.Unicode)
workbook.easy_LoadHTMLFile(streamReader)
# Export Excel file
workbook.easy_WriteXLSXFile("C:\\Samples\\HTML to Excel.xlsx")
Java:# Create an instance of the class used to import/export Excel files
workbook = gateway.jvm.ExcelDocument()
# Import HTML file with specific encoding
workbook.easy_LoadHTMLFile("C:\\Samples\\File.html", "Unicode")
# Export Excel file
workbook.easy_WriteXLSXFile("C:\\Samples\\HTML to Excel.xlsx")
Convert HTML to XLSX
EasyXLS allows you to convert HTML 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 HTML file
workbook.easy_LoadHTMLFile("C:\\Samples\\file.html");
// Export XLSB file
workbook.easy_WriteXLSBFile("C:\\Samples\\HTML to Excel.xlsb");
' Create an instance of the class used to import/export Excel filesDim workbook As New ExcelDocument
' Import HTML file
workbook.easy_LoadHTMLFile("C:\Samples\file.html")
' Export XLSB file
workbook.easy_WriteXLSBFile("C:\Samples\HTML 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 HTML file
workbook->easy_LoadHTMLFile_2("C:\\Samples\\file.html");
// Export XLSB file
workbook->easy_WriteXLSBFile("C:\\Samples\\HTML to Excel.xlsb");
C++.NET// Create an instance of the class used to import/export Excel files
ExcelDocument ^workbook = gcnew ExcelDocument();
// Import HTML file
workbook->easy_LoadHTMLFile("C:\\Samples\\file.html");
// Export XLSB file
workbook->easy_WriteXLSBFile("C:\\Samples\\HTML to Excel.xlsb");
// Create an instance of the class used to import/export Excel files
ExcelDocument workbook = new ExcelDocument();
// Import HTML file
workbook.easy_LoadHTMLFile("C:\\Samples\\file.html");
// Export XLSB file
workbook.easy_WriteXLSBFile("C:\\Samples\\HTML to Excel.xlsb");
.NET:// Create an instance of the class used to import/export Excel files
$workbook = new COM("EasyXLS.ExcelDocument");
// Import HTML file
$workbook->easy_LoadHTMLFile_2("C:\Samples\file.html");
// Export XLSB file
$workbook->easy_WriteXLSBFile("C:\Samples\HTML to Excel.xlsb");
Java:// Create an instance of the class used to import/export Excel files
$workbook = new java("EasyXLS.ExcelDocument");
// Import HTML file
$workbook->easy_LoadHTMLFile("C:\Samples\file.html");
// Export XLSB file
$workbook->easy_WriteXLSBFile("C:\Samples\HTML to Excel.xlsb");
' Create an instance of the class used to import/export Excel filesset workbook = Server.CreateObject("EasyXLS.ExcelDocument")
' Import HTML file
workbook.easy_LoadHTMLFile_2("C:\Samples\file.html")
' Export XLSB file
workbook.easy_WriteXLSBFile("C:\Samples\HTML to Excel.xlsb")
' Create an instance of the class used to import/export Excel filesSet workbook = CreateObject("EasyXLS.ExcelDocument")
' Import HTML file
workbook.easy_LoadHTMLFile_2("C:\Samples\file.html")
' Export XLSB file
workbook.easy_WriteXLSBFile("C:\Samples\HTML to Excel.xlsb")
' Create an instance of the class used to import/export Excel filesset workbook = CreateObject("EasyXLS.ExcelDocument")
' Import HTML file
workbook.easy_LoadHTMLFile_2("C:\Samples\file.html")
' Export XLSB file
workbook.easy_WriteXLSBFile("C:\Samples\HTML 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 HTML file --><cfset ret = workbook.easy_LoadHTMLFile("C:\Samples\file.html")><!-- Export XLSB file --><cfset ret = workbook.easy_WriteXLSBFile("C:\Samples\HTML to Excel.xlsb")>
.NET:# Create an instance of the class used to import/export Excel files
workbook = ExcelDocument()
# Import HTML file
workbook.easy_LoadHTMLFile("C:\\Samples\\file.html")
# Export XLSB file
workbook.easy_WriteXLSBFile("C:\\Samples\\HTML to Excel.xlsb")
Java:# Create an instance of the class used to import/export Excel files
workbook = gateway.jvm.ExcelDocument()
# Import HTML file
workbook.easy_LoadHTMLFile("C:\\Samples\\file.html")
# Export XLSB file
workbook.easy_WriteXLSBFile("C:\\Samples\\HTML to Excel.xlsb")
// Create an instance of the class used to import/export Excel files
ExcelDocument workbook = new ExcelDocument();
// Import HTML file
workbook.easy_LoadHTMLFile("C:\\Samples\\file.html");
// Export XLS file
workbook.easy_WriteXLSFile("C:\\Samples\\HTML to Excel.xls");
' Create an instance of the class used to import/export Excel filesDim workbook As New ExcelDocument
' Import HTML file
workbook.easy_LoadHTMLFile("C:\Samples\file.html")
' Export XLS file
workbook.easy_WriteXLSFile("C:\Samples\HTML 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 HTML file
workbook->easy_LoadHTMLFile_2("C:\\Samples\\file.html");
// Export XLS file
workbook->easy_WriteXLSFile("C:\\Samples\\HTML to Excel.xls");
C++.NET// Create an instance of the class used to import/export Excel files
ExcelDocument ^workbook = gcnew ExcelDocument();
// Import HTML file
workbook->easy_LoadHTMLFile("C:\\Samples\\file.html");
// Export XLS file
workbook->easy_WriteXLSFile("C:\\Samples\\HTML to Excel.xls");
// Create an instance of the class used to import/export Excel files
ExcelDocument workbook = new ExcelDocument();
// Import HTML file
workbook.easy_LoadHTMLFile("C:\\Samples\\file.html");
// Export XLS file
workbook.easy_WriteXLSFile("C:\\Samples\\HTML to Excel.xls");
.NET:// Create an instance of the class used to import/export Excel files
$workbook = new COM("EasyXLS.ExcelDocument");
// Import HTML file
$workbook->easy_LoadHTMLFile_2("C:\Samples\file.html");
// Export XLS file
$workbook->easy_WriteXLSFile("C:\Samples\HTML to Excel.xls");
Java:// Create an instance of the class used to import/export Excel files
$workbook = new java("EasyXLS.ExcelDocument");
// Import HTML file
$workbook->easy_LoadHTMLFile("C:\Samples\file.html");
// Export XLS file
$workbook->easy_WriteXLSFile("C:\Samples\HTML to Excel.xls");
' Create an instance of the class used to import/export Excel filesset workbook = Server.CreateObject("EasyXLS.ExcelDocument")
' Import HTML file
workbook.easy_LoadHTMLFile_2("C:\Samples\file.html")
' Export XLS file
workbook.easy_WriteXLSFile("C:\Samples\HTML to Excel.xls")
' Create an instance of the class used to import/export Excel filesSet workbook = CreateObject("EasyXLS.ExcelDocument")
' Import HTML file
workbook.easy_LoadHTMLFile_2("C:\Samples\file.html")
' Export XLS file
workbook.easy_WriteXLSFile("C:\Samples\HTML to Excel.xls")
' Create an instance of the class used to import/export Excel filesset workbook = CreateObject("EasyXLS.ExcelDocument")
' Import HTML file
workbook.easy_LoadHTMLFile_2("C:\Samples\file.html")
' Export XLS file
workbook.easy_WriteXLSFile("C:\Samples\HTML 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 HTML file --><cfset ret = workbook.easy_LoadHTMLFile("C:\Samples\file.html")><!-- Export XLS file --><cfset ret = workbook.easy_WriteXLSFile("C:\Samples\HTML to Excel.xls")>
.NET:# Create an instance of the class used to import/export Excel files
workbook = ExcelDocument()
# Import HTML file
workbook.easy_LoadHTMLFile("C:\\Samples\\file.html")
# Export XLS file
workbook.easy_WriteXLSFile("C:\\Samples\\HTML to Excel.xls")
Java:# Create an instance of the class used to import/export Excel files
workbook = gateway.jvm.ExcelDocument()
# Import HTML file
workbook.easy_LoadHTMLFile("C:\\Samples\\file.html")
# Export XLS file
workbook.easy_WriteXLSFile("C:\\Samples\\HTML to Excel.xls")