Extract Images From Excel in Node.js

Extract Images From Excel in Node.js

The goal of this blog post is to extract images from Excel in Node.js programmatically. Now, It is quite easy to extract images from documents such as Excel files, Word files, and more. We will use this JavaScript library to perform the image extraction by writing a few lines of source code in a Node.js-based application. However, you can process and manipulate Excel Worksheets to meet your business needs. So, let’s start this guide and learn image extraction automation.

The following points will be covered in this guide:

Image extraction library installation

The installation procedure of this JavaScript library is very quick. Therefore, you may either download the API package or install it by running the following commands:

npm install java
npm install aspose.cells

Extract Images From Excel in Node.js

You can open, modify and save Excel documents using this JavaScript library. In this section, we will write the code snippet and the steps to perform the image extraction from Excel files programmatically.

The following are the steps:

  1. Create a Workbook object from the source file.
  2. Get the first worksheet by calling the get method.
  3. Invoke the getPictures().get method to get the first Picture in the first worksheet.
  4. Set the output image file path.
  5. Instantiate an instance of the ImageOrPrintOptions class.
  6. Specify the image format as JPEG or PNG.
  7. Save the image by calling the toImage method.

Copy & paste the following code into your main file:

The output can be seen in the image below:

image extraction

Get a Free License

You can avail a free temporary license to try the API without evaluation limitations.

Summing up

This is the end of this blog post. I hope you have learned how to extract images from Excel in Node.js programmatically. In addition, you can do many other things using this JavaScript library and meet your software requirements. Finally, the documentation offers complete details regarding development and installation.

Moreover, we suggest you follow our Getting Started guide.

Finally, conholdate.com is writing new blog posts. So, please stay in touch for regular updates.

Ask a question

You can let us know about your questions or queries on our forum.


How do I extract an image from Excel?

This link contains the steps and the code snippet that help you build an image extraction module for your business application.

See Also