When working on Sheets API – Developer Metadata it becomes clear that some of the request objects can go to quite a depth, so you end up doing something like this.

This becomes more complicated when say, a.b.c already exists, and has already some other stuff in it. One way round this is to use an extend type function – there is one available in my cUseful.Utils library so you could do this to merge the new data into the old object.

But – you still have to construct that complex object.

Here’s an alternative way – You can get this in the cUseful library


or on github


The idea is to be able to specify the parent properties you need in the resulting object as a string

will create an object of the required structure, so you can just do this. Any existing objects in the heirarchy will be preserved, and any missing ones will be added

or even this

Here’s some examples and results

The code

Propify code is the library, but also below for convenience. There’s not much to it, but it’s pretty handy.

For more like this see Google Apps Scripts Snippets
Why not join our community , follow the blog or following me on Twitter