How to Convert Excel to JPG in Node.js

How to Convert Excel to JPG in Node.js

Automation of Excel to JPG conversion helps when preparing business presentations. Large Excel files are difficult to attach to PowerPoint slides, so converting them to JPG images is a practical solution. In this post you will learn how to convert Excel to JPG in Node.js using the XLSX JS library and build an Excel to JPG converter.

In this blog post, the following points will be covered:

XLSX JS library installation

The library installs easily. You can either download the API package or run the commands below:

npm install java
npm install aspose.cells

How to Convert Excel to JPG in Node.js

The library offers many features. Follow these steps to create an Excel to JPG converter programmatically.

  1. Initialize a Workbook instance and load the source file.
  2. Create an ImageOrPrintOptions object to set image options.
  3. Use the setImageType method to choose the image format.
  4. Call the get(index) method to access the first worksheet.
  5. Instantiate a SheetRender object for the target sheet.
  6. Loop through the pages and invoke the toImage method to generate images.

Copy & paste the following code into your main file:

The output appears as shown below:

Excel to JPG converter

Get a Free License

You can obtain a free temporary license to try the API without evaluation limits.

Summing up

You now know how to convert Excel to JPG in Node.js programmatically. This guide helps you build an Excel to JPG conversion module with the XLSX JS library. For more details, visit the documentation.

We also recommend reading our Getting Started guide.

Stay tuned to conholdate.com for new blog posts and updates.

Ask a question

Post your questions or queries on our forum.

FAQs

How do I convert Excel to image?

Follow the link for the code snippet and steps to convert Excel to JPG/JPEG programmatically.

See Also