user2012403
user2012403

Reputation: 205

GAS and Google Sites...trouble with gadget

Q1-I have a working google apps script for a spreadsheet. I want to display the spreadsheet results on a Google Sites page. Couldn't get my deployed script talking, so I tried a very simple one embedded in the Site:

function doGet() {
   return ContentService.createTextOutput('Hello World');
}

Just get a blank in the gadget display box. I'm set up as the owner, so it shouldn't be a permissions issue.

Q2- I'd like the sites page to have 4 GAS gadgets on the same page. Do the scripts/functions need to be broken out so each is tied to a doGet() ?

Q3- Is there a simpler service for creating a simple XML/dynamic table with the spreadsheet results?..or is google Sites the best approach? Thanks in advance--

Nathan

Upvotes: 0

Views: 165

Answers (1)

Phil Bozak
Phil Bozak

Reputation: 2822

Q1: TextOutput is not an acceptable display for a Sites gadget. Read about it here. Only HtmlOutput and UiInstance are acceptable.

Q2: If you're going to have 4 gadgets, you will need 4 projects each with its own doGet(e). You can't have multiple doGet(e) functions in the same project.

Q3: To try to give you some options here. If you're using Google Sites just to display your script output, you don't need to do that. You can publish scripts to the web so they run just like a webpage. In this web app, you can create multiple elements. See charts where you can create a lot of different great visualizations for some data. Look into UiApp to understand how to add multiple elements to a UI.

Upvotes: 0

Related Questions