excel to html

Convert Excel to HTML in Java

We use Excel workbooks to perform data entry, organize data, perform accounting jobs, conduct financial analysis, time management, task management, and much more. The conventional approach of storing data in the form of rows and columns is quite an amazing and convenient approach. We often have a requirement to share the stored information among fellow members who might be viewing the worksheets on different platforms including desktop and mobile. So they definitely would require some application to open and view the data. However, if we convert Excel to HTML format, it can be viewed on any platform without requiring any additional software. So in this article, we are going to learn the steps to develop an online Spreadsheet viewer.

Excel to HTML Converter

Aspose.Cells Cloud SDK for Java provides the capabilities to save Excel to PDF, Excel to JPG, Excel to HTML, and a variety of other formats. The conversion does not require MS Office Automation or any other application installed and all the conversion is performed in the cloud. Now in order to proceed with conversion, we need to include the following information in the pom.xml of the maven build type project.

        <name>Aspose Java API</name>

Once the SDK reference is added to the project, you need to create an account over Aspose Cloud and lookup/create Client ID and Client Secret at Cloud Dashboard.

Excel to Web in Java

In this section, we are going to discuss the details of how you can develop an online spreadsheet viewer by simply converting Excel to HTML.

  • Create an instance of CellsApi while providing client credentials as input arguments
  • Specify the name of input Excel, resultant format as HTML, and output file name
  • Read the content of the Excel file from local storage into the File instance
  • Finally, call the method cellsWorkbookPutConvertWorkbook(…) to initiate the conversion operation
excel to csv file preview

image1:- Excel to HTML file preview

You may notice an amazing capability of the API that individual worksheets are appearing as tabs in resultant HTML. The input Excel used in above example can be downloaded from myDocument.xlsx.

Convert Excel to HTML using cURL Commands

The REST APIs can easily be accessed through cURL commands so in this section, we are going to discuss the details on how to convert XLS to HTML using cURL commands. But before we initiate the Excel to HTML conversion, we need to generate a JWT access token while executing the following command.

curl -v "https://api.aspose.cloud/connect/token" \
-d "grant_type=client_credentials&client_id=bbf94a2c-6d7e-4020-b4d2-b9809741374e&client_secret=1c9379bb7d701c26cc87e741a29987bb" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"

Now that we have JWT token, we need to execute the following command to convert XLS to HTML and save the output in cloud storage.

curl -v -X PUT "https://api.aspose.cloud/v3.0/cells/convert?format=HTML&outPath=converted.html&checkExcelRestriction=true" \
-H  "accept: multipart/form-data" \
-H  "authorization: Bearer <JWT Token>" \
-H  "Content-Type: multipart/form-data" \
-d {"File":{}}


In this article, we discussed the details of how to convert Excel to HTML using Java code snippets. At the same time, we have also learned the conversion of XLSX to HTML using cURL Commands. As our SDKs are built under an MIT license, so the complete source code can be downloaded from GitHub.

If case you encounter any issues while using the APIs, please feel free to contact us via the product support forum.

We highly recommend visiting the following links to learn more about: