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

Combine multiple sheets into one single object? #110

Open
magnusfox opened this issue Apr 28, 2020 · 2 comments
Open

Combine multiple sheets into one single object? #110

magnusfox opened this issue Apr 28, 2020 · 2 comments

Comments

@magnusfox
Copy link

Thank you for a great plug-in! What I'm requesting might be possible already, but I can not get it to work. I'm trying to configure an array of objects that contain sub-objects. This works fine using nested elements. However, I would like to be able to use multiple sheets to "write" into the same object. I.e, I want to define the basic properties of the object in one sheet and then use other sheets to define the "inner objects" of the objects defined in the first sheet. The below is an export from 2 different sheets using the unwrap feature. Is there any way that I could map the "InnerObject" so it would become a property of the regular object?

The reason for this is to avoid having one single enormous sheet with all the nested properties, but instead define the sub properties in other sheets.

{ "Objects": [ { "Id": "Object1", "RegularProperty": "Prop1" } ], "InnerObject": { "Title": "Inner object" } }

Any help much appreciated!

@Synthoid
Copy link
Owner

Synthoid commented May 3, 2020

What you want should be possible, you would just need to use the path to the end object as part of the key for each column. Something like:

[Objects]{#ROW}Title

Would look for a root array called Objects then grab the element indexed at the current row, and assign the Title field.

@magnusfox
Copy link
Author

Sorry, I can't get it to work. I have two sheets, one with the following content:

[Objects]{#Id} | [Objects]Title
Id1 | Title1
Id2 | Title2

And a second one with this:
[Objects]{#ROW}SheetTwoProperty
Value1
Value2

With Nested Elements only checked I get this result:

{ "US_Sheet1": { "Objects": [ { "Id": "Id1", "Title": "Title1" }, { "Id": "Id2", "Title": "Title2" } ] }, "US_Sheet2": { "Objects": [ { "SheetTwoProperty": "Value1" }, { "SheetTwoProperty": "Value2" } ] } }

If I use unwrapping with sheet prefix I get this:

{ "Objects": [ { "SheetTwoProperty": "Value1" }, { "SheetTwoProperty": "Value2" } ] }

In the second attempt the property from sheet 2 was overwriting instead of adding,

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