Stream

 
My recent experiments with GAS let me to do some research into alternatives. This blog post is the result of my research, in case anyone is interested.
 
Web Apps are apparently the future. And why not? Browsers have become full fledged virtual machines capable of running powerful Javascript applications, and HTML and CSS have both evolved to include a lot more than just text and pretty colours. One of the…
Web Apps are apparently the future. And why not? Browsers have become full fledged virtual machines capable of running powerful Javascript applications, and HTML and CSS have both evolved to includ...
1
1
István Maczkó's profile photoEric Schultz's profile photoGAS LibraryApp's profile photo
3 comments
 
The notion of collaborative use cases has not reached main stream yet. Developers who are familiar with storage-programmable logic controllers already have the kind of thinking, but not with respect to daily procedures. It will take a couple of years for most of us to master collaboration, in day to day life and in Apps development. Even the intro: "Do more. With Google. With Apps Script, you can create add-ons for Google Sheets, Docs, or Forms, automate your workflow, integrate with external APIs, and more." does not mention "collaboration" because "workflow" is what people are used to. https://developers.google.com/apps-script/?hl=de
Add a comment...

Lee ViDemantay

Case studies  - 
 
PLease start this issue we need webkit support in App Script HtmlService
2
Add a comment...

Martin Hawksey
moderator

Case studies  - 
 
Lovely story to come out as a result of the Google Docs and Sheets add-ons highlighting the power of our hyper-connected world and what is possible with students as producers.

Read how 16 year-old Tim Cargan volunteered his time to redevelop autoCrat as a Google Docs Add-ons
6
1
Sarah Chauncey's profile photoFaustino Rodriguez's profile photo
 
great story, thanks for sharing
Add a comment...

CG-Glass AS

Case studies  - 
 
Hello! We have developed a rather large orderhandeling system customized for the glassindustry. 
We use Cloud SQL for storage of simple text and numbers data and Drive for storage of binary data. 
The systems works great but we are looking to improve speed performance. Without going into code details, can someone give input, tips on how to make GAS as fast as possible?
All input appriciated

Thanks 
Lars
1
1
Bryan Patterson's profile photoBob Minnaert's profile photoCG-Glass AS's profile photo
17 comments
 
+Bryan Patterson thanks for your input. Will look into this
Add a comment...

Tong Sun

Case studies  - 
 
Open Spreadsheet by Id

Hi, 

I changed from opening Spreadsheet from ActiveSpreadsheet to by ID:

-------------------------------
  // var ss= SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet 1");
  Logger.log("file_id: " + file_id);
  var ss= SpreadsheetApp.openById(file_id);
  Logger.log(ss);
  ss = ss.getSheetByName("Sheet 1")
  Logger.log(ss);
-------------------------------

And now the previous working code no longer works any more. Here is the logger output:

[14-02-05 19:30:06:024 EST] file_id: 0ApsxqxxxxN2c
[14-02-05 19:30:06:777 EST] Spreadsheet
[14-02-05 19:30:07:275 EST] null

How can I make it working? 
Thanks
1
Tong Sun's profile photo
 
Got it. This is working,

 -------------------------------
 var ss= SpreadsheetApp.openById(file_id);
  Logger.log(ss);
  Logger.log(ss.getName());
  var sheet = ss.getSheets()[0];
  Logger.log(sheet);
-------------------------------

while the OP is now. 
Add a comment...
 
Google Drive encountered an error for my GAS code

Hi, I'm getting the following errors:

------------------------------------
Google Drive encountered an error. If reloading the page doesn't help, please report the error.

To learn more about Google Drive, please visit our help center.

We're sorry for the inconvenience. Thanks for your help!
------------------------------------

What's really strange to me is that, the code is really really simple:

------------------------------------
function init() {
  var app = UiApp.createApplication().setTitle("My Sample");
  app.createDocsListDialog().showDocsPicker();
  //var doclisthandler = app.createServerHandler('chosenHandler')
  //app.createDocsListDialog().showDocsPicker(); //.addSelectionHandler(doclisthandler).setWidth(350).setHeight(650).setDialogTitle("Choose a file"). setInitialView(UiApp.FileType.DOCUMENTS)
  
  return app;
 }

 function doGet() {
   return init();
 }
 

//function chosenHandler(eventInfo) {
  // After you've chosen a Google Document, save the chosen Document's id into hidden fields

//  var parameter = eventInfo.parameter;
//  var eventType = parameter.eventType;
//  var source = parameter.source;
//
//  var file_id = parameter.items[0].id
//  var file_name = parameter.items[0].name
//  var file_url = parameter.items[0].url
//  
//  var file = DocsList.getFileById( file_id )
//  var file_name = file.getName()
//  
//  // Update the app's interface
//  var app = UiApp.getActiveApplication();
//  app.getElementById("file_id").setText( file_id )
//  app.getElementById("file_name").setText( file_name ).setVisible( true )
//
//  return app
//}
------------------------------------

Moreover, if I remove all the commented code, it will work!!! 

What the comments has to do with my code? Why adding those comments and my code stops working?!

This is really really strange. 

Any idea? Thx
1
Rory Smith's profile photoTong Sun's profile photo
5 comments
 
+Tong Sun No problem.  I remember having the same problem the first time I tried publishing a web app!  Very frustrating since it's not clearly documented how to "authorize" your app, it just says you'll need to do it.
Add a comment...

Tong Sun

Case studies  - 
 
Clear time-based Trigger

Hi, I was trying the 
Tutorial, http://labnol.org/?p=28237 

but it didn't work. 

However, since then, almost everyday I'll receive an email entitled: "Summary of failures for Google Apps Script..." saying that the Google Apps Script that I tried failed. 

I open up the file and try to view the Triggers, but I got

    No triggers set up. Click here to add one now.

Any way to stop this running-loose script? 

thanks
8
4
Robbi King's profile photoAllison Liang's profile photoJose Alzueta Mancoeduca's profile photoTong Sun's profile photo
10 comments
 
No luck, the failure emails are still coming, while the the "Google Drive Permissions - Digital Inspiration" is not in the access list.
Add a comment...
 
google-apps-script to iterate throw google-spreadsheet

Hi, Any existing GAS code sample showing how to iterate a google-spreadsheet like iterating a DB table using google-apps-script? Simply printing the column contents alone the way would be fine.

I can put the question on stackoverflow if you prefer. 

Thanks
1
Bruce Mcpherson's profile photoTong Sun's profile photo
12 comments
 
+Bruce Mcpherson Terrific! Thank you, thank you!
Add a comment...
 
Any one posting to A Facebook page? Or know is it possible or not?
1
GAS LibraryApp's profile photo
 
Use a Google Apps Site Announcement Page and a Facbook Service for automatically reading the RSS feed : see https://www.facebook.com/LightRecycler. 
Add a comment...
 
*Create HTML forms easy *
#forms   

I have made a script, to quickly generate a HTML form to use in HTML Service. Because you can build JSON objects, you can quick and simple construct a good form to use for many project. I found myself building static HTML everytime and wanted to get a bit more dynamic.

This is all the code, you can use it as a library and use the 'create' function to make a form.

https://script.google.com/d/1ow3c6RoxY1XZ6811_X7lRCxr9Am9XyNYhAlhZpCsi361H0vIIcthnD72/edit?usp=sharing

I would love to make this script better and better, and love your input to make it grow.

See the script to find out how it works. 

One thing I would like to ask: what would be the best way to set up the HTML, so you can change the layout best while using CSS? Should I give standard classes? What would be nice HTML?
12
3
Jose Alzueta Mancoeduca's profile photoFaustino Rodriguez's profile photoWill Welch's profile photoGAS LibraryApp's profile photo
2 comments
 
I'll give it a try and provide some feedback, thanks +Riël Notermans 
Add a comment...
 
Had a couple free moments this weekend and decided to use Apps Script in part of my Home Automation.  Here you go hopefully the first #appsscript  Garage Door Opener with a +ControlByWeb Dual Relay .

Update: Link to document about project.
https://docs.google.com/document/d/1t-B7_IlBhcJz3xiNfXZrqnGsm1wjhsiWpXGM6upaqqc/edit
26
5
James Swansburg's profile photoLinda Lawton's profile photoFaustino Rodriguez's profile photoAsan Kaceri's profile photo
4 comments
 
so cool and simple (after you did it, of course ;)
thanks for sharing and cheering up the weekend !!
Add a comment...

Will Welch

Case studies  - 
 
 
Here is a script I built for reserving resources (carts, labs, etc.) for our school.  Feel free to take a look and modify the code to meet your needs.
5
2
Verónica Arcay's profile photoJosi Ayensa's profile photo
Add a comment...

Amit Agarwal

Case studies  - 
 
More resources for learning Apps Script

0. https://developers.google.com/apps-script/case-studies 
1. http://www.scoop.it/t/gas - by +Martin Hawksey  
2. http://www.labnol.org/internet/google-scripts/28281/ - by +Amit Agarwal 
3. scriptsexamples - by +Romain Vialard 
4. http://shop.oreilly.com/product/0636920032557.do - by +James Ferreira 
5. https://www.youtube.com/playlist?list=PL68F511F6E3C122EB - by +Eric Koleda and +Arun Nagarajan 

[*] I shared this list in a comment earlier but thought of sharing it as a separate post since it will benefit all.

[Update] Added new YouTube playlist.
39
21
Tim Van Dusen's profile photoR Lomeli's profile photoAlexander Ivanov's profile photoPierre-Henri BEGUIN's profile photo
4 comments
 
/sub
Add a comment...

Tong Sun

Case studies  - 
 
web app that returns HtmlOutput

From https://developers.google.com/apps-script/reference/html/html-output

I see that we can do:

function doGet() {
   return HtmlService.createHtmlOutput('<b>Hello, world!</b>');
 }
 
But what if I need to use the doGet to build a GUI first, say take the string "Hello, world!" from user input. How can I have both user GUI rendering then the HtmlOutput? 

thanks
1
Add a comment...

Tong Sun

Case studies  - 
 
app.createHTML(variable) and url within

I remember seeing a post saying variable didn't work for app.createHTML, but I can't find it any more. Anyway, what I found is that, 

If my variable contains the following string:

-------------
Robert Palmer - Addicted To Love<br/>
<a href='Robert Palmer - Addicted To Love'>Robert Palmer - Addicted To Love</a><br/>
Music video by Robert Palmer performing Addicted To Love. (C) 1985 The Island Def Jam Music Group.<br/><p/>
-------------

The result of app.createHTML shows everything but the url. The line where the url supposed to be is totally empty. 

What's wrong? 
Thanks
1
Tong Sun's profile photoMartin Hawksey's profile photo
5 comments
 
+Martin Hawksey Fare enough. Thanks again for your help. 
Add a comment...

Tong Sun

Case studies  - 
 
Publish scripts programmatically

I'm trying the

Publish scripts programmatically
http://googleappsdeveloper.blogspot.ca/2012/04/introducing-script-service.html

in so as to publish scripts from Google Spreadsheets. However it never works. It either ask for my permission then do nothing, or it tell me "Script authorization expired. Please run it again"

Anyone knows how to get it working? 
3
Add a comment...

Tong Sun

Case studies  - 
 
Present YouTube.Search results

From, 

Building on YouTube APIs in the cloud with Google Apps Script
http://apiblog.youtube.com/2013/12/building-on-youtube-apis-in-cloud-with.html

It shows that searching YouTube using GAS is as simple as:

function searchByKeyword() {
  var results = YouTube.Search.list("id,snippet", 
                   {q : "google apps script", maxResults: 25});
  
  for(var i in results.items) {
    var item = results.items[i];
    Logger.log("[%s] Title: %s", item.id.videoId, item.snippet.title);
  }
}

My question is, instead of logging to Logger, what's the easiest way to present the results back to the user? 

Direct url or code sample appreciated. I can also put the question on stackoverflow if you prefer. 

Thanks
1
Tong Sun's profile photo
2 comments
 
Ok, now, how about some not-so-easy way? -- I add a loop of keywords to the search and now my log was so large that it get truncated. I just want to get the results for myself, that's why I was thinking the easy the better. Thx.
Add a comment...

Tong Sun

Case studies  - 
1
Tong Sun's profile photoAlpha Yang's profile photo
5 comments
 
thx
Add a comment...

Feng Chen

Case studies  - 
 
I have created a VerticalPanel():
var productPanel = app.createVerticalPanel();

Then I created a button:
var voteButton = app.createButton("Click");

And then I add the button into the panel:
productPanel.add(voteButton);

But how could I center horizontally the button? Thanks for help!
1
Add a comment...

Rhonda Jenkins

Case studies  - 
 
I'm trying to simplify this process . . . Any help would be so appreciated!
My students take a spelling test using Google Forms. I then use Flubaroo to grade it. Students and teachers  are not on the same domain, nor is Gmail turned on for elementary students, so I cannot email the results. I learned about autocrat and now use it to create a merged document of test results. 
In order for my merge document to look the way I want it, I do paste Flubaroo results and original student submissions in a spreadsheet. I then use formulas to "place" scores and + marks for correct answers and x for incorrect answers according to results from Flubaroo. I aso have if statements for grade percentages . . . I know, it all sounds involved, but it works and parents and students understand the results. Finally, I have to special paste the formulas/data "values" only into the sheet I use with autocrat to generate my merged documents. 

Is there an easier way? It truly does not take that long for me, but for someone not so savvy . . . what can I do? Any suggestions?
Here's a link to my original form submissions pasted doc: http://goo.gl/YVrVoi Here's a link to my spelling autocrat document: http://goo.gl/xKZVyK Here's a link to my spelling merged document: http://goo.gl/FpCQs1
1
Add a comment...