To make it easier to work with data in Google Apps Script, both from spreadsheets and from JDBC databases, I have developed the ObjDB library. This is a set of functions, with which you can open a spreadsheet or database, and do all the basic operations: select, update, insert, delete. Functions are the same for spreadsheets and for JDBC databases, except the different parameters for the open() function, so if you start with data in a spreadsheet, and later move the data to a database, there is hardly any code to change.
To show how the library works, I prepared a demo spreadsheet with script. Open the link, it should create a new copy of the spreadsheet, if not, copy it yourself. Then go to Tools – Script editor…, and run any of the functions to see it in action.
Note that the script in this spreadsheet includes the objDB library, see under Resources – Manage Libraries….
For more documentation, reference and source code, go to http://googlescripts.harryonline.net/objdb.