Skip to content

Commit

Permalink
Added nodejs + typescript sample
Browse files Browse the repository at this point in the history
  • Loading branch information
Metastasis committed Oct 12, 2020
1 parent 666148c commit d75fcc5
Show file tree
Hide file tree
Showing 13 changed files with 989 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
lib/
lib
node_modules/
coverage/
.nyc_output/
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ interface Person {
Sample integration with `xlsx-import` are placed in [./samples](./samples) directory. Currently available:

* [NodeJS sample](./samples/nodejs/) of **importing an invoice** - it is pure JS example which runs on nodejs.
* [NodeJS + TS sample](./samples/nodejs-ts/) of **importing an invoice** - it is Typescript example that can be transpiled down to pure JS or run directly with ts-node.

# The configuration:

Expand Down
36 changes: 36 additions & 0 deletions samples/nodejs-ts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# NodeJS + Typescript

This is an example how to use `xlsx-import` in node + typescript.

**LIB Version:** `2.3.1`

## Usage

```bash
# install dependencies
npm install

# execute
npm start

# or execute and save into file
./node_modules/.bin/ts-node src/index.ts > result.json
```

## What happened?

1. Read spreadsheet file [Invoice.xlsx](invoice.xlsx)
2. Following config import invoice data
3. Map, return and display data _(should be same as [result.json](result.json))_.

## What is worth to see here?

1. Study config and interfaces: [`invoiceConfig.ts`](src/configs/invoiceConfig.ts)
2. Usage package in [`importer.ts`](src/importer.ts)

## What later:

1. Study documentation: [docs](./../../README.md)
2. Start using `xlsx-import` in your project
3. Ask a lot, report bugs and request for help: https://github.com/Siemienik/xlsx-import/issues
4. [Sponsor `xlsx-import` project](https://github.com/sponsors/Siemienik)
Binary file added samples/nodejs-ts/invoice.xlsx
Binary file not shown.
Loading

0 comments on commit d75fcc5

Please sign in to comment.