xlsx2md
TypeScript icon, indicating that this package has built-in type declarations

0.7.1 • Public • Published

xlsx2md

Library to support conversion from OpenXML spreadsheet documents to Pandoc's markdown grid tables.

Usage

const xlsx2md = require('xlsx2md');
const fs = require('fs');

const archive = fs.readFileSync('./tests/sample.xlsx');

const configString = `<?xml version="1.0" encoding="utf-8" ?>
<xlsx2md>
    <SheetLoader>
        <Sheet name="">
            <Title><![CDATA[Table 1. A sample table name]]></Title>
        </Sheet>
    </SheetLoader>
</xlsx2md>`;

const result = xlsx2md.convert(archive, 80, configString);

fs.writeFileSync('./tests/output.md', result, {
    encoding: 'utf-8'
});

Result

Table: Table 1. A sample table name

+:--------:+:-------------:+:--------------:+:--------------------------------:+
|**№**     |{{B1}}         |**Amount**      |**Unit&nbsp;Price**               |
+----------+---------------+----------------+----------------------------------+
|1         |Unit&nbsp;A    |1               |$100\.00                          |
+----------+---------------+----------------+----------------------------------+
|2         |Unit&nbsp;B    |2               |$2\,000\,000\.00                  |
+----------+---------------+----------------+----------------------------------+
|3         |Unit&nbsp;C    |3               |$300\.58                          |
+----------+---------------+----------------+----------------------------------+
|**Original&nbsp;Price**                    |**$2\,000\,400\.58**              |
+----------+---------------+----------------+----------------------------------+
|**Discount**                               |**30\.3%**                        |
+                                           +----------------------------------+
|                                           |**\-$606\,782**                   |
+----------+---------------+----------------+----------------------------------+
|**Current&nbsp;Price**                     |**$1\,393\,619\.07**              |
+----------+---------------+----------------+----------------------------------+
|**Expiration&nbsp;Date**                   |2023/10/1&nbsp;09\:10\:01\.234    |
+----------+---------------+----------------+----------------------------------+

---
'meta-Table 1. A sample table name':
  '@align-r2c2': 'AlignLeft'
  '@align-r2c4': 'AlignRight'
  '@align-r3c2': 'AlignLeft'
  '@align-r3c4': 'AlignRight'
  '@align-r4c2': 'AlignLeft'
  '@align-r4c4': 'AlignRight'
  '@align-r5c2': 'AlignRight'
  '@align-r6c2': 'AlignRight'
  '@align-r7c1': 'AlignRight'
  '@align-r8c2': 'AlignRight'
  '@align-r9c2': 'AlignRight'
  'B1': |
    **Unit&nbsp;Name**
---

Package Sidebar

Install

npm i xlsx2md

Weekly Downloads

15

Version

0.7.1

License

MIT

Unpacked Size

1.57 MB

Total Files

6

Last publish

Collaborators

  • qfield