/* Google Sheet and WebApp You MUST have an id column as the first column in your sheet and use the arrayformula in cell A1 in order for this to work: "={"id";ArrayFormula(if(B2:B<>"",row(A2:A)-1,""))}" The arrayformula relies on there being content in every row of Column B, so ensure that you always use a dataset that has entries in every row of at least one column You can edit the formula to point to that column (B2:B) Do not enter any data in column A otherwise you will break the array formula / numbering If you delete a record in the middle of the dataset the id numbering will change This is the same as in Ai2, so if you delete record 5, record 6 will become record 5. These scripts are dynamic so should work with any number of columns and rows Remember to always re-publish your script if you make any changes The google sheet can remain private, and things will work as long as you publish the web app for "Anyone, even anonymous" Do not add any blank rows below the last record in the sheet, otherwise newly created entries will go to the bottom because of the array formula on column A The example creates the web app in a bound script to the sheet. If you prefer you can build you web app in a separate script file You can manually add records to the spreadsheet directly, just remember you do not need to enter an id, this will happen automatically The script includes a "lock" which should prevent concurrent changes You may need to enable additional API's with Google for this to work (Google should tell you what to do!) Keep your headers as short as possible and abbreviate where needed - aim for max. 6 letters (this will help display/list alignment in the app) AI2 The example project file is dynamic so can accept and work with a dataset of any shape and size (device memory willing!) For specific, unchanging needs, the blocks can be re-written for a set number of columns The app will always send an entire record with each header and field for creating and updating. Always ensure that they are present in the url. The app only sends the record id for deleting The dataset is only ever temporarily stored on the app, the root/master dataset is on the google sheet (google sheets has an excellent version history too) The dataset is updated to the app after every CRUD action The basis for all CRUD activities is the url which is constructed from the url to the web app, and then the parameters gnerated by CRUD activity. All urls must include a "func" parameter as the first parameter - ?func=Update&.... the options being: Create, ReadAll, ReadQuery, ReadRecord (not used), Update, Delete The set of control buttons at the bottom of the app work as follows: With the summary listing you can Create and Read With the individual listing, you can Create, Update, Delete and go Back and using the Next/Previous buttons at the top, you can move from record to record ReadQuery allows you to return a subset of records to work with, based upon a query you build Queries are built using the Google Query Language which is very similar to standard SQL You can test your queries before calling them back into the app proper ("Set") The query MUST always start with "SELECT *" You can run any valid query with "Test", but you must use "SELECT *" for "Set" The "Insert" button will allow you to select a field name, this is converted to a column letter. */