Convert Excel Files to HTML in Node.js

C++ Excel to HTML

Excel files are widely used to store and organize the data in the form of worksheets. Furthermore, you can perform various computations as well as analysis of the data. However, in certain cases, you have to convert the Excel files into other formats. For example, you may need to convert an Excel worksheet to HTML or image in order to display it within your web or desktop application. For such cases, this article covers how to convert Excel files to HTML in Node.js applications. In addition, you will learn how to use additional options to customize the converted HTML.

Node.js Excel to HTML Converter API

Aspose.Cells for Node.js via Java API is designed to implement spreadsheet automation from within your Node.js applications. It provides a range of features to manipulate Excel files seamlessly. Furthermore, the API allows you to convert Excel files to other formats. In order to use the API, you can download its package from the Downloads section or use the following NPM command.

> npm install aspose.cells

Convert Excel Files to HTML in Node.js

When converting an Excel file to HTML, Aspose.Cells for Node.js via Java creates a separate tab for each worksheet. Thus, you can navigate between the sheets quite easily. The following are the steps to convert an Excel file to HTML.

The following code sample shows how to convert an Excel file to HTML using Node.js.

Excel File

Excel File

Converted HTML

Excel to HTML

Enable Gridlines in Excel to HTML Conversion in Node.js

By default, the gridlines are disabled in the converted HTML file. However, you can enable them using the HtmlSaveOptions class. The following are the steps to perform this operation.

The following code sample shows how to enable gridlines in Excel to HTML conversion.

Converted HTML

Excel to HTML GrdiLines

Enable Tooltip in XLSX to HTML Conversion in Node.js

In some cases, the values may exceed the width of the cells in a worksheet. In such situations, you can enable the tooltips to display complete text in the converted HTML. The following are the steps to enable tooltips in Excel to HTML conversion.

The following code sample shows how to enable tooltip in Excel to HTML conversion in Node.js.

Include Hidden Sheets in XLS/XLSX to HTML Conversion

Excel workbooks may also contain the hidden sheets that are not included in Excel to HTML conversion by default. In order to render hidden sheets, you can use HtmlSaveOptions.setExportHiddenWorksheet() method. The following are the steps to perform this operation.

The following code sample shows how to include hidden sheets in Node.js Excel to HTML conversion.

Get a Free API License

In case you want to try the API without evaluation limitations, you can get a free temporary license.

Conclusion

Excel to HTML conversion is often used in web applications to display worksheets on web pages. In accordance with that, this article has covered how to convert Excel workbooks to HTML files in Node.js. Furthermore, you have seen how to customize the Excel to HTML conversion with different options. You can explore more about Aspose.Cells for Node.js via Java using documentation.

See Also