How to Print an Excel File in Node.js

How to Print an Excel File in Node.js

Printing documents programmatically can provide a competitive edge to your business. As it is a very common task so this sort of automation will reduce the time and effort of your workforce. In this blog post, we will install this JS Excel library in our Node.js project to manipulate and process Excel documents. However, let’s start and implement how to print an Excel file in Node.js.

We will cover the following points in this blog post:

JS Excel library installation

You may visit this link to learn the installation procedure of this enterprise-level library. It is quite easy as you can either download the API package or install it by running the following commands:

npm install java
npm install aspose.cells

How to print an Excel file in Node.js

Once installation is completed, you can start writing the source code and explore the methods to configure your API calls.

The following are the steps:

  1. Create an instance of the WorkBook class and load the source Excel file.
  2. Instantiate an object for ImageOptions class that allows specifying options when rendering worksheets to images, and printing worksheets.
  3. Get the first worksheet by invoking the get method.
  4. Create a SheetRender object with respect to your desired sheet which can render worksheet to various images.
  5. Print the worksheet by calling the toPrinter method.

Copy & paste the following code into your main file:

The output can be seen in the image below:

printing software

Get a Free License

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

Summing up

We are ending this blog post here with the hope that you have learned that how to print an Excel file in Node.js. In addition, you may customize your code snippet to meet your business software programmatically. Moreover, you may visit the documentation of this JS Excel library to know other methods.

Moreover, we suggest you follow our Getting Started guide.

Finally, 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 get Excel to print automatically?

Follow this link to get the code snippet that prints Excel files programmatically.

See Also