tcoulson
tcoulson

Reputation: 624

Creating a web app from Google Sheet

https://gist.github.com/mhawksey/1276293

I am trying to understand this post, and specifically how to change var ss = SpreadsheetApp.openById("your_sheet_ID"); I am not sure what they are referring to as the sheet_ID, where would I find that id? In addition, I am not sure what the comments in the code mean when it says "Insert column names on your destination sheet matching the parameter names of the data you are passing in (exactly matching case)" because I am looking at line

var headRow = e.parameter.header_row || 1;

and it is not being used anywhere else in the code? I would have thought that would be using headRow in some way, but it appears it is not working that way. Instead it looks like

row.push(e.parameter[headers[i]]);

Is taking every passed in parameter and using row to then apply data to the sheet, is this correct? This would make sense, because when I test the web app from latest code it gives me back this:

{"result":"error","error":{"message":"Bad value","name":"Exception","fileName":"script","lineNumber":49,"stack":"\tat script:49 (handleResponse)\n\tat script:32 (doGet)\n"}}

Which I assume is because that button does not pass any parameters. So there is an error.

I am trying to figure out if I can post a form from a custom website into a google sheet to save my .org company some money and just update a spreadsheet directly from a form. That way we can save on database space and they can track new sign ups. Let me know your thoughts, and if writing new items to the sheet is the way to go.

Upvotes: 0

Views: 2514

Answers (1)

Karl_S
Karl_S

Reputation: 3574

The Sheet ID is found in the URL. Best described in the documentation for openById(id)

For the Web App in your page, see HTML Service: Create and Serve HTML for information on creating an HTML interface. You can create the entire HTML and script using this information and publish it as a web app which runs either as you, having your permissions to access the file, or as the end user, allowing you to use their ability to access information and also allowing for knowing who made a change. Once published, you can include the web app in an iFrame or provide a link to the app to open as its own page.

Upvotes: 1

Related Questions