The nested data structure and the resulting dynamic columns mean that you can't just set up a standard script and expect to always work.
Recognise this is quite a difficult problem to solve and don't know of any easy way to get round it. But I think this is quite an existential question for the usefulness of the SDK. If it doesn't allow things to be automated, it won't be used at all.