Stream

Join this community to post or comment
Pinned by moderator

Ivan Kutil
owner

News  - 
 
Dont forget (06/2015)

■ Migrating from OAuthConfig to the OAuth1 library by June 26, 2015
https://developers.google.com/apps-script/migration/oauth-config

■  UiApp will be removed from documentation and autocompleteon June 30, 2015. If you have built any UIs using UiApp, they will continue to work. http://googleappsdeveloper.blogspot.cz/2014/12/speeding-up-htmlservice.html

(short recapitulation created on April 5, 2015)
#gde   #post #googleappscript  
15
1
Eric Koleda's profile photoDavid Prekul's profile photo
 
Excellent reminder, thanks a ton!
Add a comment...

Riël Notermans

Problem/Coding Help  - 
 
"UrlFetch failed because too much upload bandwidth was used"

Upload bandwith? What does this mean?
1
Add a comment...
 
So I went to check out the release notes as part of my daily morning routine, and lo and behold, Google Developers has been materialized! It looks nice, and the reference pages are much better.
Create add-ons for Google Sheets, Docs, or Forms, automate your workflow, integrate with external APIs, and more.
6
Martin Hawksey's profile photoJeff Earls's profile photo
2 comments
 
Gorgeous, love it, great interface composition and use of space.
Add a comment...

Andrew Roberts

Tips & tricks  - 
 
On a Chromebook you can keep a script open even when it's containing doc/sheet is closed.

This is really useful when you are working with big GDocs as ChromeOS keeps dumping tabs and reloading them to save its valuable RAM (this could be excuse I've been looking for to buy a Pixel!) so you can close the containing doc and keep working on the script. I've tried this on Chrome browser and it closes the script when the containing doc is closed.
1
Riël Notermans's profile photoMike Treacy's profile photo
3 comments
 
This is expected behavior but there is one way to revert it. Open the Doc/Sheet and the Script attached. Then, close the Doc/Sheet (both tabs will close). Hit CTRL + SHIFT + T to reopen just the Script. This has always worked for me.

That being said, you should buy the new Pixel anyway!

(I have the LS and love it :P )
Add a comment...

Kathryn van Nieuwkerk

Problem/Coding Help  - 
 
Anyone want to test a webapp for me? Especially iPhone users. It seems the confirm popup doesn't work in safari... :/
1
Daniel Frost's profile photoKathryn van Nieuwkerk's profile photo
4 comments
 
OK thanks, I've taken the pop up out. Safari just doesn't like it. 
Add a comment...

Nadav Topaz

Problem/Coding Help  - 
 
I'm working on a google spreadsheet that takes information from several sheets and feeds them into one major "combined" spreadsheet. I have a script that detects if a certain keyword, such as "y" is entered into a cell, and will make the entire row of that cell turn green, indicating completion.

The issue is that on the combined spreadsheet, the "y" shows up but the row is not turned green. I feel that this is because the script doesn't detect "y", as the cell is pointing to the original location instead of having "y" in there. 

Is there a way to work around this? I know of a way using conditional format, but it uses either the INDIRECT() function or static ($) which would force me to go into every single row and do it manually, and I have nearly 10,000 rows...
1
Nadav Topaz's profile photoOman Komarudin's profile photo
3 comments
 
How if you add the trim function for the final_inspect variable
Add a comment...

Abdeslam Bennani

Problem/Coding Help  - 
 
hi all, i am trying this small script which should create a file named test123 and delete but not sure why in the first run it s not able to find the file it self but on  the 2nd run it does. any idea what i am missing?
is there a kind of "commit" after the file creation?
function myTest() {
  SpreadsheetApp.create("test123");
   var files = DriveApp.getFilesByName("test123");
   Logger.log(files);
  while (files.hasNext()) {
    var file = files.next();
    file.setTrashed(true);
    Logger.log(file.getName()+" Trashed");
  } 
}
1
Spencer Easton's profile photo
 
It always best to reference by fileId when possible.

var ss = SpreadsheetApp.create("test123");
var ssId  = ss.getId();
var driveFile = DriveApp.getFileById(ssId);
driveFile.setTrashed(true);
Logger.log(driveFile.getName()+" Trashed");
Add a comment...

Martin Mullan (Mart)

Problem/Coding Help  - 
 
I'm trying to replicate  +Martin Hawksey 's web app from here: https://mashe.hawksey.info/2014/07/google-sheets-as-a-database-insert-with-apps-script-using-postget-methods-with-ajax-example/
When I press the send button, I receive the "sending data" message but my spreadsheet doesn't populate. I noticed this is the same with Martin's example; has Google changed something to break the script?
2
3
Martin Mullan (Mart)'s profile photoJohn Sartoris's profile photo김진달's profile photoLucian Chen's profile photo
4 comments
 
Lol.😄 rest young one....!
Add a comment...

Stephen Gale

Tips & tricks  - 
 
Hoping that someone can help me out here or point me in the right direction.  I have a Google Site that I would like to display text dynamically from a Google Document.  I was hoping that I could populate a HTML Box or Text Box with the body of a Google Document while keeping the Theme of the site.  Having not played with Google App Scripts within Google Sites, I am wondering if this is possible.
1
Martin Mullan (Mart)'s profile photoStephen Gale's profile photo
10 comments
 
I am using Awesome Tables gadget in other instances of the same site (https://sites.google.com/a/wgsd.us/home/home/staff/directory and https://sites.google.com/a/wgsd.us/home/home/about-us/board/blueprint)

I think that I would fork their project if I were to do a gadget...
Add a comment...
 
I need some help with a script that notifies form submissions. Can anyone help?
1
Daniel Frost's profile photoNeha Gaba's profile photo
4 comments
 
can you please explain what you want to do exactly
Add a comment...

Bruce Mcpherson
moderator

Tips & tricks  - 
 
Did you know you can access Microsoft OneDrive (and any other MS Live SDK services) from Apps Script. It uses Oauth2 just like the Google Drive API. 

I've just added it to the Apps Script cEzyOauth2 services library.

#gde   #googleappsscript   #blogpost  
12
4
Bruce Mcpherson's profile photoKarl Wirén's profile photoBarb Greco's profile photoLucian Chen's profile photo
3 comments
 
We will probably be ok if u get rid of one of the Chromes the got me on os canary and beta I'm not 64 bit I'm 32 bit just call me if y ou hack questions don't b vain now and I still have not sycing. ...
Add a comment...

About this community

Google Apps Script is a JavaScript cloud scripting language that lets you extend Google Apps and build web applications. Scripts are developed in Google Apps Script’s browser-based script editor, and they are stored in and run from Google’s servers. Community managed by - Ivan Kutil (GDE) - Martin Hawksey (GDE) - Romain Vialard (GDE) - Bruce Mcpherson (GDE) - Eric Koleda (Google)

Jimmy McClure

Problem/Coding Help  - 
 
Any help is appreciated.
I place the file uploader in my app and receive the following:
Authorization is required to perform that action.

This is a link to Google's documentation about the file uploader.....
https://developers.google.com/apps-script/guides/html/communication#forms
1
Ivan Kutil's profile photoJimmy McClure's profile photo
4 comments
 
as owner
Add a comment...

Andrew Roberts

Problem/Coding Help  - 
 
Losing POST request from YouCanBook.me webhook

I've set up a webhook on YouCanBook.Me for a booking notification (POST request) to be sent to my Google Apps Script web app. But the doPost() doesn't ever get called.

I've tried accessing the URL for the app from various other places - other websites, curl, jsfiddle, etc - and these all call the doPost() but nothing from the YCBM webhook.

I've spoken with YCBM tech-support and they confirm that they get a 200 response to the webhook, so it looks like Google is happy with the POST just doesn't pass it onto my doPost().

How could I go about debugging this further ...

http://stackoverflow.com/questions/30516143/losing-post-request-from-youcanbook-me-webhook
1
Add a comment...

Darlene Maxfield

Problem/Coding Help  - 
 
HI,
Thanks for all the great videos on scripts, I viewed another one yesterday, but can't figure out how to fix this.  I want an email notification sent to me when these sheets and cell ranges are changed with a description of the change:  Example (sheilaj page, item added to column Q). I can live without the detail if i could just get a summary of the sheet that was changed.

Any help would be appreciated. Thanks.

function myFunction() {
  MailApp.sendEmail('darlenem@amhomelife.org',"notification rules - SBL changes", "Modifications made on var sheet = New copy of SBL");
  function emailnotification () {
var doc = ("https://docs.google.com/spreadsheets/d/1pb0YsjpIs3AabcFbGpnKe1Y4Az6AX923eFr4N0wgAdg/edit#gid=391184179");
    var sheet = ("Barry Shaffer")
    var cellvalue = ("!O:Q")
    var sheet = ("David Lindhiem")
    var cellvalue = ("!O:Q")
    var sheet = ("Gail Goolsby")
    var cellvalue = ("!O:Q")
    var sheet = ("Jennifer Cranston")
    var cellvalue = ("!O:Q")
    var sheet = ("Kelli Chestnut")
    var cellvalue = ("!O:Q")
    var sheet = ("Lorelei Kay")
    var cellvalue = ("!O:Q")
    var sheet = ("Sheila Johnson")
    var cellvalue = ("!O:Q")}
};
1
Darlene Maxfield's profile photoHolger Hubbs's profile photo
3 comments
 
Yes, this makes sense. I am interested in your solution! This will be a great add-on.
Add a comment...

Philippe Creytens

Problem/Coding Help  - 
 
Cloud printers: suggestions to avoid having users to "accept" sharing settings from assigned cloud printers

Users need to accept the sharing of a cloud printer. Is there away (with GAS) to assign a printer to a group of users without them having to accept it?
1
Stephen Gale's profile photoPhilippe Creytens's profile photo
4 comments
 
Why didn't I think of that... 
Add a comment...

Bruce Mcpherson
moderator

Tips & tricks  - 
 
Will probably start going through the publishing process for this Add-on sometime next week.

If any volunteers are interested in testing it out before I do, here's the write up.

You can test it from here. 

https://docs.google.com/spreadsheets/d/16ztPLVxqZUkItu-_rIi1FJ5TNlh7X9TcgBtcl1f7CTY/edit?addon_dry_run=AAnXSK-fcoOEduEyJkkCGeRhRoUp0j__96M6oANhfoR7VJhXM6lbxYOFg0veqPP2caWUektccwOiCPlq84oPbUrGn8F3L-upOkQzAm2taJU3CSHebdbCelsPHm5a72hKqeYILIipHyoS#gid=0

thanks 
#gde   #googleappsscript   #blogpost  
Liberate Excel data from the desktop
4
2
SECUNDINO GARCIA JIMENEZ (CQ)'s profile photoDave Mac's profile photo
Add a comment...

Martin Mullan (Mart)

Problem/Coding Help  - 
 
I have been trying to alter a google form to allow buttons to be pressed which increment/decrement the values in the fields. The linked page is my source info and the examples work, but when I try to replicate the behaviour in the gform it only creates the +- buttons, the buttons themselves don't change the field value. Thoughts?
Google docs easily integrates in a web page if embedding the code for calling their forms, in that way we only have to worry about placing it in the right place and Google makes the rest. Nevertheless, Google forms have a standard view which could break your site design, moreover, ...
1
1
Martin Mullan (Mart)'s profile photoSpencer Easton's profile photo김진달's profile photo
3 comments
 
Honestly this is DIV soup. The script is minified and unreadable.  But if you want an input that has increment and decrement buttons that step up and down a value use a number input. 
Add a comment...

David Wynter

Problem/Coding Help  - 
 
I have a sidebar where I list saved estimates as shown here:

function getValues(){
  google.script.run.withSuccessHandler(onSuccess).createEstimatorList();
}

function onSuccess(data) {
  for (var key in data) {
    var row = document.createElement("DIV");
    var selbtn = document.createElement("BUTTON");
    selbtn.onclick = function() {
        this.onclick=null;
        window.alert(data[key]);
        google.script.run.recoverEstimate(data[key]);
    }
    selbtn.style.border = "0px white";
    selbtn.style.borderBottom = "1px solid #0000FF";
    var est = document.createTextNode(key); 
    selbtn.appendChild(est);    
    var br = document.createElement('br');
    selbtn.htmlFor = key;
    var delbtn = createDeleteBtn(key);
    delbtn.style.marginLeft = "3px";
    delbtn.style.marginBottom = "3px";
    row.appendChild(selbtn)
    row.appendChild(delbtn);
    row.appendChild(br);
    document.getElementById("estimates").appendChild(row);     
  }
}

I also put a window.alert when I build the rows to show the data[key] value and of course it is correct. But when I click a selbtn that changes from the current selection it always has the last key in the array in the selection? I create new objects each for loop so not sure how this can be?
1
Daniel Frost's profile photo
2 comments
 
Also, I would have messed up on calling the variable properly in the template example. Data['key'] would be myarray[i]['key'].

Let me know if this helps, or if you have more questions.
Add a comment...

.Santanu Chakrabarti

Problem/Coding Help  - 
 
I am totally frustrated with Google Apps Script. I wanted to submit the following JSON as POST request body and process it inside doPost method. But I am not able to do it.

{
        "name" : "labnol",
        "blog" : "ctrlq",
        "type" : "post",
        "topic" : ["abc","xyz","pqr"],
        "comments" :
        {
          "from" : "ffffff",
          "text" : "hhggfgghj"
        }
      }

doPost method
=============
function doPost (request) {
  Logger.log("doPost called...")
  Logger.log(request)
  if (typeof request !== 'undefined') {
    Logger.log(request)
  }
 
  //var jsonString = request.postData.getDataAsString()
  //var jsonData = JSON.parse(jsonString)
 
  var outJson = {}
 
  var topic = JSON.parse(request.postData.contents.topic)
 
  return ContentService.createTextOutput(JSON.stringify(outJson))
                       .setMimeType(ContentService.MimeType.JSON)
}

Test function
===========
function testPOST() {
  var url = ScriptApp.getService().getUrl();
  var payload =
      {
        "name" : "labnol",
        "blog" : "ctrlq",
        "type" : "post",
        "topic" : ["abc","xyz","pqr"],
        "comments" :
        {
          "from" : "ffffff",
          "text" : "hhggfgghj"
        }
      };
  var options =
      {
        "method"  : "POST",
        "contentType" : "application/json; charset=utf-8",
        "payload" : payload,  
        "followRedirects" : true,
        "muteHttpExceptions": true
      };
 
  var result = UrlFetchApp.fetch(url, options);
 
  if (result.getResponseCode() == 200) {
    
    //var params = JSON.parse(result.getContentText());
    
    Logger.log(result.getContentText());
  }
 
}

Log entry after I ran the test function
==============================
[15-05-26 20:16:51:533 IST] <!DOCTYPE html><html><head><link rel="shortcut icon" href="//ssl.gstatic.com/docs/script/images/favicon.ico"><title>Error</title><style type="text/css">body {background-color: #fff; margin: 0; padding: 0;}.errorMessage {font-family: Arial,sans-serif; font-size: 12pt; font-weight: bold; line-height: 150%; padding-top: 25px;}</style></head><body><div><img src="//ssl.gstatic.com/docs/script/images/logo.png"></div><center>SyntaxError: Unexpected token: u</center></body></html>

SO I AM GIVING UP WITH GOOGLE APPS SCRIPT. IT CAN DO SIMPLE THINGS BUT NOT AT ALL READY TO DO MODERATELY COMPLEX THINGS.
1
.Santanu Chakrabarti's profile photoRiël Notermans's profile photo
28 comments
 
Absolutedly possible :)
Add a comment...

MP Dev

Problem/Coding Help  - 
 
I am trying to make a copy of a file and move it to a folder. I am using the makeCopy(name, destination) method that I found in the Google Apps Script documentation.

But I keep getting an error:
Missing ) after argument list. (line 63, file "Code")

for the following line of code:
 var copy = DriveApp.getFileById('1P4iPEnns5BlXYmuOS8KnMtBBEVuqC4M5dreFfWOxHuM').makeCopy(lastName + " - " + "Booking", Customer Detail Files);

lastName is a variable I have declared that gets data from a spreadsheet cell.
It works fine if I omit the folder name "Customer Detail Files" from the line. It then however, only makes the copy in the folder of the original file.

I feel like I may have some kind of error with the syntax between the parentheses. 

Any help would be greatly appreciated. 
1
MP Dev's profile photoNeha Gaba's profile photo
3 comments
 
Specify a folder name in makeCopy,it will help
Add a comment...