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

Hash Worksheet titles #14

Open
cfoulston opened this issue May 10, 2017 · 4 comments
Open

Hash Worksheet titles #14

cfoulston opened this issue May 10, 2017 · 4 comments

Comments

@cfoulston
Copy link

Would be nice if we could include worksheet titles in the json result.
Currently if all worksheets are included in a single json. Each worksheet is an array element.
Maybe a flag to determine if worksheets are treated as objects or array elements?

@bassarisse
Copy link
Owner

bassarisse commented May 11, 2017

I think this is the same problem this PR is addressing, right? As mentioned there, we should probably add an option for that.

@cfoulston
Copy link
Author

Similar. I'd like the Worksheet Title to become the name of the object like:

{
	"Worksheet Title 0": {

		"Hashed Id 0": {
			"Column 2": "Some Value",
			"Column 3": "Some Value"
		},		
		"Hashed Id 1": {
			"Column 2": "Some Value",
			"Column 3": "Some Value"
		}
	},
	"Worksheet Title 1": {

		"Hashed Id 0": {
			"Column 2": "Some Value",
			"Column 3": "Some Value"
		},		
		"Hashed Id 1": {
			"Column 2": "Some Value",
			"Column 3": "Some Value"
		}
	},
	"Worksheet Title 3": {

		"Hashed Id 0": {
			"Column 2": "Some Value",
			"Column 3": "Some Value"
		},		
		"Hashed Id 1": {
			"Column 2": "Some Value",
			"Column 3": "Some Value"
		}
	}
}

I'm trying to integrate GSheets data into Google Firebase. The JSON Editor is horrible over there so I was hoping to use this and use their "Import JSON" feature. However, the Firebase structure is a tree and not array. So I need to be able to use strings as the name of an object.

In that PR, seems like the solution is to add a "title" and "index" as values. My request is different in that I want that "title" to be the key/hash of the Worksheet object

@bassarisse
Copy link
Owner

bassarisse commented May 11, 2017

If this wasn't a CLI tool, I think the suggested format (a list of objects with title and index) would be better, as it is more generic and can be transformed into whatever format the user wants. Like so:

data.reduce((result, sheet) => {
  result[sheet.title] = sheet.data
  return result
}, {})

However, as I'd like the tool to remain as standalone as possible, offering a way to control the result is more adequate, so I'll probably add a option so you can choose between various result formats (one of them being what you need).

@cfoulston
Copy link
Author

That would be great. Thanks

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

No branches or pull requests

2 participants