GithubHelp home page GithubHelp logo

json2xlsx's Introduction

Json2XLSX

Provide or pipe a JSON object to a new Excel XLSX file

Takes an object with one worksheet (tab) per key, and a 2d array or array of objects.
Updates an existing file if already created.

{
	"worksheet1": [
		[1,2,3],
		[4,5,6]
	],

	"worksheet2": [
		{a: 1, b: 2},
		{a: 3, b: 4}
	]
}

Write Excel

require('json2xlsx').write(filename, sheetname, [object]);    

or pipe..

$ echo '{"work1": [["TRUE",2,3], [4,5,6]], "work2": [{"a": 1, "b":2},{"a":3, "b": 4}]}'\
| node -e "require('./json2xlsx.js').write('file.xlsx')"

# update existing
$ echo '{"work3": [["TRUE",2,3], [4,5,6]], "work4": [{"a": 1, "b":2},{"a":3, "b": 4}]}'\
| node -e "require('./json2xlsx.js').write('file.xlsx')"

# show additional info about writing (set env variable)
$ debug=1 ...

###Read Excel

require('json2xlsx').read('file.xlsx');  // JSON written to console/stdout
# or
$ node ./json2xlsx file.xlsx

##Order JSON attributes (to have columns in order in Excel)

echo "..." | require('json2xlsx').write('name.xlsx', 'sheetname', null, ['first_col_name', 'second_col_name'])

json2xlsx's People

Contributors

jemiloii avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.