excel to html

Convert Excel to HTML using C# .NET

Excel spreadsheets are widely used for data storage and analysis, but they can be difficult to access and view online. The solution to this problem is to convert Excel spreadsheets to HTML tables, which are easily accessible and viewable on the web. With Aspose.Cells Cloud, this process has become even easier and more efficient. In this article, we will discuss how to use Aspose.Cells Cloud to convert Excel spreadsheets to HTML tables, and explore the other benefits of using this solution for your conversion requirements. Whether you are a developer or an end-user, this article is designed to provide you with the information you need to get started with Excel to HTML conversion.

Excel to Web Conversion API

Enjoy seamless integration, advanced features and fast conversion capabilities of Aspose.Cells Cloud. It’s a cloud-based API that provides a simple and efficient solution for converting Excel spreadsheets to HTML tables. Convert XLS and XLSX to HTML tables with just a few lines of code, eliminating all the need for manual data entry and freeing up your time for more important tasks. So, whether you need to publish data online, share it with your team, or automate your workflow, Aspose.Cells Cloud provides a flexible and scalable solution for your Excel to HTML conversion needs.

Now, as per the scope of this article, we need to add Aspose.Cells Cloud SDK for .NET reference as a NuGet package in our C# .NET solution. Search “Aspose.Cells-Cloud” in NuGet package manager and add the package.

Aspose.Cells Cloud

Image 1:- Aspose.Cells Cloud NuGet package.

Furthermore, in order to use the API capabilities, we also need to have a Cloud dashboard account. If you are not already subscribed, please create a free account over Cloud Dashboard using valid email address and obtain your personalized client credentials.

View Spreadsheet Online using C#

Let’s discuss the steps on how online spreadsheet feature can be accomplished using C# .NET.

excel to html

Image 2:- Excel to Web conversion preview.

Use the following link to download the sample Excel worksheet (myDocument.xlsx) used in the above example.

Let’s understand the above code snippet:

CellsApi instance = new CellsApi(clientID, clientSecret);

Create an object of CellsApi where we pass the client credentials as arguments.

var file = System.IO.File.OpenRead(name)

Read the input Excel worksheet using OpenRead(…) method of the System.IO.File class.

instance.CellsWorkbookPutConvertWorkbook(file, format: format, outPath: resultantFile);  

This method triggers the Excel to HTML conversion operation and saves the resultant HTML in Cloud storage.

Excel to HTML Online using cURL Commands

Excel to HTML conversion can be achieved using cURL commands, which allow you to interact with Aspose.Cells Cloud API and perform various operations, including Excel to HTML conversion. Here’s a simple example of how to convert an Excel spreadsheet to HTML using cURL commands:

  1. Upload your Excel spreadsheet to a cloud storage platform, such as Google Drive or Dropbox.
  2. Obtain an API key from Aspose.Cells Cloud, which will be used to authenticate your API requests.
  3. Generate JWT access token based on client credentials using the following command.
curl -v "https://api.aspose.cloud/connect/token" \
-d "grant_type=client_credentials&client_id=bb959721-5780-4be6-be35-ff5c3a6aa4a2&client_secret=4d84d5f6584160cbd91dba1fe145db14" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"
  1. Now use the following cURL command to convert your Excel spreadsheet to HTML:
curl -v -X GET "https://api.aspose.cloud/v3.0/cells/myDocument(1).xlsx?format=HTML&isAutoFit=true&onlySaveTable=false&outPath=resultant.html&checkExcelRestriction=true" \
-H  "accept: application/json" \
-H  "authorization: Bearer <JWT Token>"
  1. Once the cURL command is executed, the resultant HTML is saved to cloud storage.

  2. Now, instead of cloud storage, if we need to save the HTML to local drive, please try using the following cURL command:

curl -v -X GET "https://api.aspose.cloud/v3.0/cells/myDocument(1).xlsx?format=HTML&isAutoFit=true&onlySaveTable=false&checkExcelRestriction=false" \
-H  "accept: application/json" \
-H  "authorization: Bearer <JWT Token>" \
-o "resultant.html"

Try using our free online Excel Converter App.

Concluding Remarks

In conclusion, converting Excel spreadsheets to HTML tables is a common task for many businesses and organizations, and Aspose.Cells Cloud provides a powerful and flexible solution for their needs. By using Aspose.Cells Cloud SDK for .NET, you can convert Excel spreadsheets to HTML tables quickly and easily, with just a few lines of code. Additionally, Aspose.Cells Cloud offers a range of features, including support for multiple programming languages, integration with popular cloud storage platforms, and a user-friendly interface, making it an ideal solution for businesses and organizations of all sizes. Whether you need to publish data online, share it with your team, or automate your workflow, Aspose.Cells Cloud provides a reliable and scalable solution for your Excel to HTML conversion needs.

We also recommend exploring the Product Documentation, as it contains a collection of topics explaining other exciting features of the API. Lastly, if you encounter any issues while using the API, please feel free to contact us via the free Product Support Forum.

Please visit the following links to learn more about: