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

Define option to sheets based on sheet index #25

Open
khanisak opened this issue Jan 29, 2019 · 5 comments
Open

Define option to sheets based on sheet index #25

khanisak opened this issue Jan 29, 2019 · 5 comments

Comments

@khanisak
Copy link

Can we give an option for sheet based on index not name?
So I want to give an option to second sheet or third sheet whatever the sheet name is.

@DiegoZoracKy
Copy link
Owner

This is a good idea. I have to check on the xlsx (the module being used under the hood to get the data from a spreadsheet) to see if it has an option for that. Currently it returns me all the sheets as an object literal where the keys are the names of the sheets.

@gerhardx
Copy link

gerhardx commented Oct 28, 2019

For anyone interest in doing something index sheet based. An easy implementation would be:

jsonObj: result from excel converter
i: variable to access sheet page

  1. Keymap sheets names with var index = Object.keys(jsonObj)
  2. Access the sheet with your data object like: jsonObj[index[i]]

@DiegoZoracKy If you think this would be a good option, I can help to create a pull request.

@DiegoZoracKy
Copy link
Owner

Hi @gerhardx, this is a good idea, however the property order of a Object Literal is not guaranteed. So your code access by index the result of Object.keys which cannot be guaranteed to be the exactly order of the sheets on source file.

@y0x
Copy link

y0x commented Feb 27, 2020

@DiegoZoracKy I think this would be a quite useful feature. Will you implement it?

@DiegoZoracKy
Copy link
Owner

Hi @y0x, yes it would be possible to be implemented, however, unfortunately I don't have time to code that at the moment. If you, @gerhardx or someone else would be interested in to work on it I can provide you further guidance on this task. We would need to have a new config option named sheetsIndex, and then use it at this flow of the code:

let sheetsToGet = (_config.sheets && _config.sheets.constructor === Array) ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants