Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added nodejs + typescript sample #45

Merged
merged 1 commit into from
Oct 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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