These Data Manipulation Classes have been migrated from VBA so that the Google Docs spreadsheet data can be abstracted from its physical location in the same way as most of the projects on this site abstract data from Excel. This is not the best way to deal with data in Apps Script, but is provided in case you want to migrate from their equivalent in Excel.
var ds = new cDataSet(); ds.populateData(wholeSheet("inputdata"));
VBA
dim ds as new cDataSet; ds.populateData wholeSheet("inputdata")
var dSets = new cDataSets(); dSets.create(); dSets.init(rData,undefined , "data"); dSets.init(rParam,undefined ,undefined , true, "roadmap colors"); dSets.init(rParam,undefined ,undefined , true, "containers"); dSets.init(rParam,undefined ,undefined , true, "options"); dSets.init(rParam,undefined ,undefined , true, "custom bars");
VBA
Set dSets = New cDataSets With dSets .create .init rData, , "data" .init rParam, , , True, "roadmap colors" .init rParam, , , True, "containers" .init rParam, , , True, "options" .init rParam, , , True, "custom bars" End With
dSets.dataSet("data").rows().forEach( function (dr,drItem) { // do something with each dr (the cDataRow) or drItem (the item number of each row) } );
VBA
With dSets.dataSet("data") ' create for each datarow For Each dr In .rows ' do seomthing with dr ( the cDataRow) Next dr End With
dSets.dataSet("options").cell("frameplot", "value").toString();
VBA
dSets.dataSet("options").cell("frameplot", "value").toString
Transitioning is covered more comprehensively in my book, Going Gas – from VBA to Apps script.
You can find the latest complete code for cDataSet and related classes in the mcpher library
bruce mcpherson is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. Based on a work at http://www.mcpher.com. Permissions beyond the scope of this license may be available at code use guidelines