XToolset Versions Save

Typed import, and export XLSX spreadsheet to JS / TS. Template-based create, render, and export data into excel files.

v2.4.7

6 months ago

v2.4.7 xlsx-renderer and xlsx-import

Thanks for each single contribution, you're fantanstic!

What's Changed

@dependabot

New Contributors

Thank you!

Full Changelog: https://github.com/Siemienik/XToolset/compare/v2.4.4...v2.4.7


SiemaTeam

v2.4.4

2 years ago

What's Changed

New Contributors

Full Changelog: https://github.com/Siemienik/XToolset/compare/xlsx-renderer-v2.4.3...v2.4.4

xlsx-renderer-v2.4.0

3 years ago

XLSX-Renderer

In this release, two similar proposals were done. Both use string interpolation to gain indeed result.

TemplateFormulaCell

https://github.com/Siemienik/XToolSet/pull/158 (PR https://github.com/Siemienik/XToolSet/pull/160) for the request from @jasonclake.

image

  • Starts with #=
  • This one allows you to put a template string (custom formula) into a cell as a formula. To write in a variable use ${pathToVariable}.
  • For instance: #= ${summaryFormula}(A2:A${item.__endOutput.r}) gives something like =MAX(A2:A2910)

TemplateStringCell

https://github.com/Siemienik/XToolSet/pull/152 (PR https://github.com/Siemienik/XToolSet/pull/161) for the request from @jacekkoziol.

image

  • Starts with #`
  • Template string allows us to create advanced text, such as concatenating two variables or putting them into a sentence. To write in a variable use ${pathToVariable}.
  • For instance: #Hello ${name}! How are you?</code> gives for instanceHello World! How are you?`

Kind regards, Paweł Siemienik [email protected]

You can catch me for a chat on Gitter.

v2.3.3

3 years ago

Mappers

Read more about mappers and how to use it.

booleanMapper

in #54 by @machadolucasvp - Thank you!

Map string into boolean

import {booleanMapper} from 'xlsx-import/lib/mappers';

booleanMapper('1'); // returns true
booleanMapper('0'); // returns false

numberMapper

in #55 by @machadolucasvp - Thank you!

Map string into float number

import {numberMapper} from 'xlsx-import/lib/mappers';

numberMapper('1.5'); // returns 1.5
numberMapper('0.05'); // returns 0.05

integerMapper

in #56 by @machadolucasvp - Thank you!

Map string into integer

import {integerMapper} from 'xlsx-import/lib/mappers';

integerMapper('1.5'); // returns 1
integerMapper('0.05'); // returns 0

integerMapper https://github.com/Siemienik/xlsx-import/pull/56 @machadolucasvp

Documentation & contributing improvements

The pull requests #66 and #67 introduced markdown linter and GH workflow to automatically performing lint fixing.

v2.3.2

3 years ago

Build-in mappers:

The v2.3.2 introduce many ready to use value mappers and additional samples.

🚀 All contributors many thanks (@Gontrum, @Metastasis, @Siemienik) 🎉 You've done a lot greatness job 🥇

isEmpty

in #41 by @Gontrum - Thank you!

Examine if input is empty

import {isEmpty} from 'xlsx-import/lib/mappers';

isEmpty('asd'); // returns false
isEmpty(''); // returns true

isFilled

in #42 by @Gontrum - Thank you!

Examine if input is not empty

import {isFilled} from 'xlsx-import/lib/mappers';

isFilled('asd'); // returns true
isFilled(''); // returns false

jsonMapper

in #43 by @Gontrum - Thank you!

Try to parse json string into js object, if failed return null

import {jsonMapper} from 'xlsx-import/lib/mappers';

jsonMapper(''); // returns null because invalid input
jsonMapper('asd'); // returns null because invalid input
jsonMapper('"asd"'); // returns "asd"
jsonMapper('false'); // returns false,
jsonMapper('123'); // returns 123,
jsonMapper('false'); // returns false,
jsonMapper( '{"a":[1]}'); // returns  { a: [ 1 ] },

lowerCaseMapper

in #44 by @Metastasis - Thank you!

Changes string into lower case.

import {lowerCaseMapper} from 'xlsx-import/lib/mappers';

lowerCaseMapper('ASD'); // returns 'asd'

upperCaseMapper

in #36 by @Metastasis - Thank you!

Changes string into UPPER CASE.

import {upperCaseMapper} from 'xlsx-import/lib/mappers';

upperCaseMapper('asd'); // returns 'ASD'

splitMapper

in #50 by @Siemienik

Split string into array of items. May be customised by setting separator and item mapper: (Doing customisation do not change original mapper but create new one.)

import {splitMapper} from 'xlsx-import/lib/mappers';

splitMapper('asd,jkl'); // returns ['asd', 'jkl']
splitMapper.separator(' || ')('string,1 || string,2'); // returns ['string,1', 'string,2']
splitMapper.itemMapper(upperCaseMapper)('lower1,lover2'); // returns ['LOWER1', 'LOVER2']

Samples:

This version introduce two additional samples: All off these mappers are well tested, for lots examples how it works please study unit tests

nodejs + typescript

in #45 by @Metastasis - Thank you!

Show how to use xlsx-import in an application built on Nodejs with Typescript. For more details follow this link.

ExpressJS microservice

in #47 by @Metastasis - Thank you!

Microservice written in ExpressJS . For more details follow this link.

Other changes:

  • Fixed typos in readme and code: Thanks for @Metastasis for contribution #35
  • Enable CI for PR: #38

v2.3.1

3 years ago

This was really existing time that get results in many PR merged 🚀

Important Note:

Some functions and default exports was refactored, it means that the previous version is deprecated now. It still works same way like previous, however it will be removed on January 2021. Please follow by deprecated notes or use Migration Guide

Change List

Refactoring:

  • IMPORTANT: Obsolete default exports (#27)
  • IMPORTANT: Rename class members to cameCase (#28) - and obsolete older in PascalCase
  • Add default mapper to Importer (#19) - Many thanks for @lowkeypriority
  • Refactoring and clean up performed (#20)
    • Introduce strategies
    • Introduce enum ImportType
  • Introduce type ValueMapper, (#29)

Security:

  • Handling incorrect type param value more explicitly. (#20)

Documentation:

  • Describe configuration options (#20)
  • Added supported node versions: 7fd63b4
  • Some minor changes

Migration Guide:

  1. First rename all GetAllItems to getAllItems. Run test to prove that it doesn't fail your up.
  2. Rename all From to from, run test again.
  3. Change default imports to specific:

from: const ImporterFactory = require('xlsx-import/lib/ImporterFactory').default; to: const {ImporterFactory} = require('xlsx-import/lib/ImporterFactory');

from: import ImporterFactory from 'xlsx-import/lib/ImporterFactory'; to: import {ImporterFactory} from 'xlsx-import/lib/ImporterFactory';

  1. run test

Migration is required to proceed before January 2021, when deprecated items will be removed.

Upgrade version and resolving deprecations was done also in our sample, this PR #33 might be helpful for you.


Do you want to support my work? ❤️ Sponsor me Your issue is stuck? I can make it done, contact me for further info :)

v2.3.0

3 years ago

ExcelJS introduce version 4 more than half year ago, so it is great time to upgrade xlsx-import. Lib may stop working with node version < 10 . If problem occurs please create an issue it will be fixed soon. Also some improvements in Readme was done.

npm notice 📦  [email protected]
npm notice === Tarball Contents === 
npm notice 1.1kB LICENSE                              
npm notice 118B  lib/config/IColumnConfig.js          
npm notice 117B  lib/config/IFieldConfig.js           
npm notice 114B  lib/IImporter.js                     
npm notice 122B  lib/config/IListSourceConfig.js      
npm notice 1.5kB lib/Importer.js                      
npm notice 3.6kB lib/ImporterFactory.js               
npm notice 124B  lib/config/IObjectSourceConfig.js    
npm notice 118B  lib/config/ISourceConfig.js          
npm notice 1.6kB package.json                         
npm notice 128B  lib/config/IColumnConfig.js.map      
npm notice 126B  lib/config/IFieldConfig.js.map       
npm notice 110B  lib/IImporter.js.map                 
npm notice 136B  lib/config/IListSourceConfig.js.map  
npm notice 1.4kB lib/Importer.js.map                  
npm notice 441B  lib/ImporterFactory.js.map           
npm notice 140B  lib/config/IObjectSourceConfig.js.map
npm notice 128B  lib/config/ISourceConfig.js.map      
npm notice 2.6kB README.md                            
npm notice 113B  lib/config/IColumnConfig.d.ts        
npm notice 136B  lib/config/IFieldConfig.d.ts         
npm notice 139B  lib/IImporter.d.ts                   
npm notice 212B  lib/config/IListSourceConfig.d.ts    
npm notice 272B  lib/Importer.d.ts                    
npm notice 122B  lib/ImporterFactory.d.ts             
npm notice 187B  lib/config/IObjectSourceConfig.d.ts  
npm notice 85B   lib/config/ISourceConfig.d.ts        
npm notice === Tarball Details === 
npm notice name:          xlsx-import                             
npm notice version:       2.3.0                                   
npm notice package size:  5.7 kB                                  
npm notice unpacked size: 14.9 kB                                 
npm notice shasum:        6f0a5de39bc72d6a1b588992bda7ff758ff2b536
npm notice integrity:     sha512-LpkE2gCkfKM7R[...]wUpIaLD404qpQ==
npm notice total files:   27                                      
npm notice 
+ [email protected]
➜  xlsx-import git:(master)