I am experimenting with converting my project from a ScriptDB storage to a Spreadsheet storage. I have problems all the time with ScriptDB, and this previous answer had some great data on spreadsheet's surprising relative speed.
My problem is that my objects can have a variety of number of attributes and I am not sure that it is possible to efficiently write this kind of data in bulk.
I might have a quick test array like:
var arrData = [["sku:6100","price:16.00","Brand:Widget","Stock:2"],
["sku:6102","price:13.00","Brand:Widget","Stock:2","Somethingelse:3"]]
Writing it with:
var data_write = sheet.getRange(1, 1, arrData.length, 5).setValues(prod_data);
Will give me a complaint about the "5" length value saying it should be 4. If I use 4 it says it should be 5. Is there any way to force setValues() to write an array like this?
If not, the other two options I can see would be 1) Iterating through my array and padding it out with empty cell values to even out each row's length, or 2) Writing each object one line at a time.