Code Monkey home page Code Monkey logo

json2excel-js's Introduction

json2excel-js

It helps export to excel, using column as Array or Object.

The original porpose of it, is to help people who need to solve a problem bellow:

fields you sent:

fields: { 'label': 'Information title', 2019: 'information', 2020: 'information' }

P.S - The rows' orders doesnt matter

data: { 2019: 'information row', 2020: 'information row' label: 'information row', }

But the Object put Integer first, String at last. It's Sucks...

So, Why do not use Array ? Cuz sometimes i needn't repeat the same information at Object Keys and Values. therefore, now if you send:

fields: ["label", 2019, 2020]; <-- it will stay the same.

data: { 2019: 'information row', 2020: 'information row' label: 'information row', }

PS. the props 'fields' Accept Object and Array.

Well, solved my problem, hope it help u too.

How to Use

install the package

npm i json2excel-js

import the package

import downloadExcel from 'json2excel-js';

add on your components object

components: { downloadExcel }

Vue Page

<download-excel class="btn btn-default" # Class is optional :data="content.data" # data must be an Array of Objects :fields="translatedFields" # Array or Object :worksheet="tableName" # Name of your worksheet :name="${tableName}.xls" # Filename

<-- Here is your custom button -->
                <a
                    class="btn btn-sm btn-dark text-white"
                    style="cursor: pointer"
                    :title="$t('Exportar Para Excel')"
                >
                    <i class="fa fa-download"></i>
                </a>
<-- Be happy, good code -->

json2excel-js's People

Contributors

alexcastrodev avatar

Watchers

James Cloos avatar  avatar

json2excel-js's Issues

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.