Setup Environment and Installation Guidelines

System Requirements

Aspose.Cells for Node.js via Java is platform-independent API and can be used on any platform (Windows, Linux and MacOS) where Node.js and node-java bridge are installed. The machine must have Oracle JDK 7 or greater versions before setting up the installation.

Install from NPM

You can easily use Aspose.Cells for Node.js via Java from NPM with the following command.

 $ npm install aspose.cells

If you encounter any problems during the installation process, please refer to https://www.npmjs.com/package/java.

Install from ZIP archive

To install and use Aspose.Cells for Node.js via Java from a ZIP archive, follow the following instructions:

Linux:

  • Download and install Node.js.
  • Install Oracle JDK (1.7 or 1.8) for Linux, configure JAVA_HOME environment variable.
  • Install python 2.x
  • Install node-java bridge. You may run below commands @ terminal: 
 $ mkdir aspose.cells.js.java

$ cd aspose.cells.js.java

$ npm install java
  • Download “Aspose.Cells for Node.js via Java” and extract it into “aspose.cells.js.java/node_modules”.
  • Create a test file named hello.js using the following sample code in “aspose.cells.js.java” folder:
 var aspose = aspose || {};

aspose.cells = require("aspose.cells");

var workbook = new aspose.cells.Workbook(aspose.cells.FileFormatType.XLSX);

workbook.getWorksheets().get(0).getCells().get("A1").putValue("testin...");

workbook.save("out1.xlsx");

console.log("hello world");
  • Now run “node hello.js” @command prompt to run it.

Windows:

  • Install Oracle JDK8 and configure JAVA_HOME environment variable.
  • Install Node.js and add node.exe to PATH.
  • Install node-gyp.
  • Install Windows Build Tools.
  • Install node-java bridge and run below commands @ command prompt as an administrator:
 > mkdir aspose.cells.js.java

\> cd aspose.cells.js.java

\> npm install -g node-gyp

\> npm install --global --production windows-build-tools

\> npm install java
  • Download “Aspose.Cells for Node.js via Java” and extract it into “aspose.cells.js.java/node_modules”.
  • Create a file named hello.js in “aspose.cells.js.java” folder using the following sample code:
 var aspose = aspose || {};

aspose.cells = require("aspose.cells");

var workbook = new aspose.cells.Workbook(aspose.cells.FileFormatType.XLSX);

workbook.getWorksheets().get(0).getCells().get("A1").putValue("testin...");

workbook.save("out1.xlsx");

console.log("hello world");
  • Now run “node hello.js” @command prompt to run it.

Mac:

  • Download and install Node.js (https://nodejs.org/en/download/)
  • Install Oracle JDK 1.8 (recommended) for Mac, configure JAVA_HOME environment variable.
  • Modify JVMCapabilities section in “/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Info.plist” with root privilege. (“jdk1.8.0_152.jdk” depends on your jdk version), make it looks like following:
 <key>JavaVM</key>

        <dict>

                <key>JVMCapabilities</key>

                <array>

                        <string>JNI</string>

                        <string>BundledApp</string>

                        <string>CommandLine</string>

                </array>
  • Install python 2.x (if it is not installed).
  • Install node-java bridge. You may run below commands @ terminal:

         $ mkdir aspose.cells.js.java

         $ cd aspose.cells.js.java

         $ npm install java

  • Download “Aspose.Cells for Node.js via Java” and extract it into “aspose.cells.js.java/node_modules”.
  • Create a test file named hello.js using the following sample code in “aspose.cells.js.java” folder:
 var aspose = aspose || {};

aspose.cells = require("aspose.cells");

var workbook = new aspose.cells.Workbook(aspose.cells.FileFormatType.XLSX);

workbook.getWorksheets().get(0).getCells().get("A1").putValue("testin...");

workbook.save("out1.xlsx");

console.log("hello world");
  • Now run “node hello.js” @command prompt to run it.