With Spire.XLS, we could save Excel to HTML easily. Starts from Spire.XLS V10.4.9, Spire.XLS starts to support saving HTML to Excel in C#/VB.NET. This article will show you how to convert HTML to Excel with the help of Spire.XLS.
Firstly, view the sample HTML file:
C# of converting HTML to Excel:
using Spire.Xls; namespace HTML_to_Excel { class Program { static void Main(string[] args) { //Load the sample document Workbook workbook = new Workbook(); workbook.LoadFromHtml("Sample.html"); //AutoFit rows Worksheet sheet = workbook.Worksheets[0]; sheet.AllocatedRange.AutoFitRows(); //Save the document to file workbook.SaveToFile("Result.xlsx",FileFormat.Version2010); } } }
VB.NET
Imports Spire.Xls Namespace HTML_to_Excel Class Program Private Shared Sub Main(ByVal args() As String) 'Load the sample document Dim workbook As Workbook = New Workbook workbook.LoadFromHtml("Sample.html") 'AutoFit rows Dim sheet As Worksheet = workbook.Worksheets(0) sheet.AllocatedRange.AutoFitRows 'Save the document to file workbook.SaveToFile("Result.xlsx", FileFormat.Version2010) End Sub End Class End Namespace
Effective screenshot of converting HTML to Excel: