egeriis / zipcelx

Turns JSON data into `.xlsx` files in the browser
MIT License
293 stars 90 forks source link

Add multiple sheets #47

Closed ghost closed 5 years ago

ghost commented 6 years ago

I needed the ability to create multiple worksheets/tabs so I created a new config like this.

const config = {
    filename: 'Test',
    sheets: {
      sheet1: {
        data: [
          [{
            value: 'Income - Webshop',
            type: 'string'
          }, {
            value: 1000,
            type: 'number'
          }]
        ],
        sheetName: 'Test Sheet'
      },
      sheet2: {
        data: [
          [{
            value: 'Income - Webshop2',
            type: 'string'
          }, {
            value: 2000,
            type: 'number'
          }]
        ],
        sheetName: 'Test Sheet2'
      }

    }
  };
ghost commented 6 years ago

Ran CI locally, all tests pass and no linting errors. Although I had to add the 'testURL' property to the jest config to get Jest to run without errors.

egeriis commented 6 years ago

Hey @davidryansoftware,

Thanks a lot for your contribution. The vision of zipcelx is to provide the slimmest possible lib for creating simple spreadsheets. This means that the project is very sensitive to new features.

Considering this, the 33% increase in bundle size from this PR is in my opinion too much for comfort. Granted, this is not the uglyfied code I'm looking at, so the impact may be significantly smaller. I'm happy to receive any pushback on this 🙂

jordan-erisman commented 6 years ago

I would definitely love the option to have multiple sheets! Seems like it would be better to make the sheets property an array of sheet objects though.

linuws commented 5 years ago

Hi!

I just started using this lib and I like it a lot due to its simplicity. With that said, I'm also interested in the multiple sheets feature. I know it's a tough call between more features vs bundle size/complexity and I am not here to judge any decision but I would love to know the path going forward - if I should wait or start to look elsewhere. :)

ghost commented 5 years ago

I created a forked npm version of this, since needed it in my own project. https://www.npmjs.com/package/xlsxfromjson @linuws @erisman20 , feel free to use in the meantime since I'm not sure this PR will be merged.

egeriis commented 5 years ago

Gonna close this, since the discussion has stalled 🙂

elliotstoner commented 5 years ago

Just throwing it out there that I am definitely looking to use multiple sheets. My two cents - I think it makes more sense to have sheets be an array of Sheet objects.

In the meantime I'll probably use the fork from @davidryansoftware (depending on how much free time I have I might convert the sheets object to an array).