How to Create Hyperlinks in Excel using Node.js

How to Create Hyperlinks in Excel using Node.js

Accessing and manipulating Excel files programmatically is not difficult. Routine chores can be time‑consuming, but automating them gives your business a competitive edge. In this guide we use the XLSX Javascript library to show how to create Hyperlinks in Excel using Node.js.

The following points will be covered:

XLSX JavaScript library installation

The library provides a rich set of methods and detailed documentation. Install it either by downloading the API package or by running the commands below in your terminal or CMD.

npm install java
npm install aspose.cells

Follow these steps to add a hyperlink to an Excel file.

  1. Initialize an instance of the Workbook class.
  2. Get the first worksheet with the getWorksheets method.
  3. Retrieve the worksheet at the required index using get.
  4. Access the HyperlinkCollection via the getHyperlinks method.
  5. Call the add method to insert a hyperlink at cell A1.
  6. Save the workbook with the save method.

Copy and paste the code below into your main file:

The result looks like this:

How to Create Hyperlinks in Excel

Explore additional features of the XLSX Javascript library to meet specific business needs.

  1. Create a Workbook object.
  2. Retrieve the worksheet with get.
  3. Call getCells to obtain the Cells collection.
  4. Use get to access the target cell.
  5. Set the cell value via setValue.
  6. Change the font color to blue with setColor.
  7. Get the HyperlinkCollection using getHyperlinks.
  8. Add a hyperlink to cell A1 with add.
  9. Save the file using save.

Get a Free License

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

Summing up

You have now learned how to create Hyperlinks in Excel using Node.js and explored advanced methods of the XLSX JavaScript library. Be sure to review the documentation for more features.

We also recommend following 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 create multiple Hyperlinks in Excel?

Visit this link for a code snippet that shows how to create multiple hyperlinks in an Excel file using the XLSX JavaScript library.

See Also