Excel to JPG

Convert Excel to JPG | Learn XLS to JPG Conversion in C# .NET

Excel files are widely used for Data entry, Data management, Accounting, and Financial analysis containing data comprised of numbers, formulas, text, and drawing shapes. Similarly, the XLSB file is an Excel Binary Workbook storing information in binary format instead of XML. But even in order to view Excel files, you need to use certain applications such as Microsoft Office Excel Online, Apache OpenOffice Calc, LibreOffice Calc, etc. So we are going to discuss the steps on how to convert XLSB to JPG using REST API.

The three most common general uses for spreadsheet software are to create budgets, produce graphs and charts, and for storing and sorting data. Within business spreadsheet software is used to forecast future performance, calculate tax, completing basic payroll, producing charts, and calculating revenues.

Excel Conversion API

Aspose.Cells Cloud is our amazing API providing the capabilities to seamlessly enhance your native, web & cloud apps to provide spreadsheet processing functionality. Implement the feature to view, modify and convert Microsoft Excel & OpenOffice spreadsheets to other supported file formats. We are going to use Aspose.Cells Cloud SDK for .NET to convert Excel to JPG in C# .NET application. The SDK is available for download at NuGet and GitHub. Please execute the following command in the terminal window to perform the installation for NuGet:

nuget install Aspose.Cells-Cloud

When using .NET CLI:

dotnet add package Aspose.Cells-Cloud

Package Manager Console

If you are using Visual Studio, then the package can also be installed using the Package Manager Console. Please execute the following command:

PM> Install-Package Aspose.Cells-Cloud

Now we need to create an account by visiting Aspose.Cloud dashboard, where we can use GitHub or Google account, or Sign Up using create a new account button.

XLSB to JPG in C#

Please follow the steps given below to perform the conversion:

  • First of all, please create an instance of CellsApi while passing ClientID and ClientSecret details as arguments
  • Secondly, create string variables defining input, resultant file, and format of resultant file
  • Thirdly, create integer objects defining Horizontal and Vertical resolutions for resultant output
  • Now load the XLSB to File.OpenRead instance
  • The next step is to initialize the conversion operation using CellsWorksheetsGetWorksheet(…) method. The output is in the stream instance
  • Finally, use File.Create an instance to save the output on the system drive (as specified in saveToDisk(…) method).
Excel to Image preview

Image 1:- Preview of the resultant image.

The sample file used in the above example can be downloaded from TestCase.xlsb.

Convert Excel to JPG using cURL

As Aspose.Cells Cloud is built on REST architecture, so it can be accessed via the cURL commands. However, before proceeding further with API usage, we need to first generate a JWT access token based on Client ID and Client Secret specified over Aspose.Cloud dashboard. Please execute the following command to generate the JWT token.

curl -v "https://api.aspose.cloud/connect/token" \
 -X POST \
 -d "grant_type=client_credentials&client_id=4db2f826-bf9c-42e7-8b2a-8cbca2d15553&client_secret=d757548a9f2558c39c2feebdf85b4c44" \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -H "Accept: application/json"

Now next step is to perform the conversion of XSLB to JPEG using the cURL command. Please note the following command expects the file to be already available in cloud storage and you get the output in the Response object, which can be saved over the system drive.

curl -v -X GET "https://api.aspose.cloud/v3.0/cells/TestCase.xlsb/worksheets/Sheet2?format=JPEG&verticalResolution=800&horizontalResolution=600" \
-H  "accept: application/json" \
-H  "authorization: Bearer <JWT Token>" \
-o myNewConverted.jpeg

Conclusion

In this article, we have discussed the features to convert an XLSB to JPG. We have explored the options to convert Excel to JPG using C#.NET code snippet as well as the cURL commands. You may also access the APIs using OpenAPI Specification directly within a web browser.

Furthermore, our SDKs are open source and have an MIT license. You can use them, and even customize them absolutely free of charge. The complete source code is available on GitHub. While using the API, if you encounter any issues or you have any further queries, please feel free to contact us through the free customer support forum.

We also recommend visiting the following links to learn more about