Convert Excel to Markdown in Node.js

Convert Excel to Markdown in Node.js

MS Excel provides powerful visualizations, calculations, and easy sharing. In some cases you need to convert XLSX or XLS files to Markdown format. This article shows how to use the JavaScript Spreadsheet library to convert Excel files programmatically. Follow the steps to convert Excel to Markdown in Node.js.

The following sections are covered in this article:

JavaScript SpreadSheet library installation

This Node.js Excel library offers enterprise‑level features for processing Excel files programmatically. Visit the installation page for detailed steps, or simply download the API package and install it with:

npm install java
npm install aspose.cells

Convert Excel to Markdown in Node.js

In this section we perform the Excel to .md conversion with a short code snippet. The JavaScript SpreadSheet library lets you configure API calls to match your requirements.

Steps:

  1. Create a Workbook instance and load the source XLSX/XLS file.
  2. Instantiate a MarkdownSaveOptions object to control the conversion.
  3. Set setCreateDirectory to true so the output folder is created automatically if it does not exist.
  4. Call setClearData to clear the workbook after saving.
  5. Use setLineSeparator to define the line separator.
  6. Save the file as Markdown by invoking the save method.

Copy and paste the code below into your main file:

The resulting Markdown file looks like this:

excel-to-md

Get a Free License

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

Summing up

This concludes the tutorial. You now know how to convert Excel to Markdown using Node.js programmatically and have seen advanced options offered by the JavaScript Spreadsheet library. For more methods, visit the documentation. Stay updated at conholdate.com.

Ask a question

Share your questions or queries on our forum.

FAQs

How do I convert an Excel table to Markdown?

Install this Node.js Excel library to manipulate files programmatically. The library also converts XLS/XLSX files to Markdown easily.

How do you convert to Markdown?

See the link for the code snippet that converts Excel files to Markdown programmatically.

See Also