Stream

Join this community to post or comment

Erin West

Education  - 
 
Hi Everyone! I'm relatively new to writing scripts and learning as I go. This is cross posted but I'm looking to replicate a testing scenario for 3rd graders in Google Forms where the Back button needs to be disabled within a multi-page form. Is that even possible? 
1
Spencer Easton's profile photoErin West's profile photo
2 comments
 
ah man, thanks. I appreciate the quick feedback. Based on my research into StackOverflow and various Google Groups, I was afraid of that kind of response. :)
Add a comment...

Alan Wells

Education  - 
 
I've only watch a few minutes of this, but I found it good and helpful.
4
Add a comment...

Hlompho Mota

Education  - 
 
Is there a way to program google scripts offline with the test environment running on something like nodejs?
1
Benjamin Reich's profile photoJonathon Broughton's profile photo
2 comments
 
Notionally it isn't impossible, you could engineer your own libraries to mimic the GAS api calls, but it is a huge tonne of work and you'll be chasing any small change made to the underlying apis.

It's an interesting project in itself, but only that - a project for its own sake.

If you went down that path you could have sandbox mimic test data available if there is no online connectivity as that is the only instance where offline would be a significant advantage.
Add a comment...

Karen Jones

Education  - 
 
Hello!
In forms I would like to automatically collect respondent's username but I want to eliminate the option send me a copy of my responses. Is there a way to do this?
2
Add a comment...

Matt Goode

Education  - 
 
Hello Community, trying to figure out how to create a thesaurus Chrome Extension or Add On for Google Docs. More specifically, I want this to highlight a list of specific words (e.g happy) and offer a list of specific replacement words (did you mean: jubilant?). Does anyone have something similar that I can take a look at or that they mind sharing? 
1
Add a comment...

Nichole Carter

Education  - 
 
If I have a teacher doing reading and writing conferring and she uses a google form to quickly collect info over time, is there a way that a script or formula would then collect all of the info for one student and consolidate it in autocrat style document?
1
Nichole Carter's profile photoAlan Wells's profile photo
2 comments
 
It's definitely possible.   There are probably multiple strategies that could be used.  I just submitted an Add-on for something similar.  I'm just waiting to see if it gets approved, or if I need to fix something.
Add a comment...

Martin Hawksey
moderator

Education  - 
 
Great to see +Andrew Stillman​, who has made some wonderful contributions to the Google Apps Script and education community, get this recognition.
17
Andrew Stillman (Personal)'s profile photoBruce Mcpherson's profile photo
2 comments
 
Great achievement +Andrew Stillman 
Add a comment...

Martin Hawksey
moderator

Education  - 
 
Great piece ... I now know what I want to do when I 'retire' ... :)
 
"Embrace technology!  Don’t be afraid of it." This is one of the many suggestions that Joe Schmidt, a retired programmer, shares in our latest blog. Check out our Q&A with Joe to see how he is supporting educators with their use of Google Apps for Education!

What advice do you have for using these tools? #GAFE   #edtech
4
Michael Ellis's profile photo
 
Super write up of what he is doing.   
Add a comment...

Alan Wells

Education  - 
 
JavaScript has no "Block Scope".  If I ever heard this before, I didn't understand it until now.  I always knew that two or more "for" loops inside of a function can't have a counter variable that is the same name.  (A mistake that is often made)  But I just accepted it as "obvious", not having much experience with other languages.  The block (between the curly braces) in a "for" loop does not have it's own "scope".  The variables inside of one "for" loop, are available to other "for" loops in the same function.  For whatever reason, this "tidbit of information" seemed interesting to me.
3
Riël Notermans's profile photoBruce Mcpherson's profile photo
19 comments
 
+Alan Wells it's not implemented in the apps script js engine..
Add a comment...

Yash Bansal

Education  - 
 
I am looking for a solution to import data that is received in an email into a Google Spreadsheet. The email is a standard format with different fields that I would want to auto-populate into cells in the spreadsheet, creating a new row with each email. Is there some way to accomplish this?
Each email would create a new row, and there are approximately 15-17 cells that need to populate. 
1
Yash Bansal's profile photoAlan Wells's profile photo
9 comments
 
Here is some reference material:

http://www.w3schools.com/jsref/jsref_obj_string.asp

Troubleshooting basics:

The main troubleshooting tool, that most people use is:

   Logger.log()

There are two parts to that statement:

Logger service
log() method

Whatever you put inside the parenthesis will be printed to the “Logs”.

   Logger.log(‘My function ran!!!! I don’t believe it!’);

You can also put variables inside the parenthesis:

   var ‘myVariableName = ‘this is a test’;
   Logger.log(‘myVariableName: ‘ + ‘myVariableName);

To view the print out, click the VIEW menu, and choose: LOGS

https://developers.google.com/apps-script/troubleshooting

If you have a relatively good idea of what part of the code an error is coming from, then go directly to that area of code, and scrutinize it.  But, it often happens that many changes get made to lots of lines of code, in lots of files before running a test, and in that situation, you don’t know where the error is coming from.  Debugging efficiently is a logical process of elimination.  Think, “Sherlock Holmes”.  That’s what you need to be, a detective.   Random, trial and error will only get you so far.  There are situations where the number of different things you could try is a number so large, that you could spend your entire life, just making random changes to the code, hoping it will work, and you’d need to live to be 10,000 years old before you could try every variation.  So, if you need to find the error in a certain amount of time, random, desperate attempts to fix the problem will fail you sooner or later.

So, the “process of elimination” is the common theme in the debugging strategies that I advise you to use.  But, with that being said, the very first thing I always try is the opposite of a logical process of elimination.  I start with intuition and memory.  “It’s probably in this file, in this function, and I remember just making a change that could have given me this error”.  That’s the fastest route, IF IT WORKS.  If it doesn’t work, then you switch modes, and go through the logical process of elimination.  Where people get “stuck”, is trying to switch from desperation mode, to going through the process.  Going “through the process” is tedious, boring and could be time consuming.  It’s not a very appealing prospect.

Start at the beginning - For relatively small sections of code, just start at the beginning and trace the code through.
Delete half, then delete half again, and repeat.  For things like uncaught HTML errors.  I comment out, or delete half the functions in the script tag, or half the HTML, or CSS and try it, and see if there is an error.  Using this technique, you can eliminate 50% of the content that is not producing the error very quickly.  So, that cuts the amount of code you need to review in half, in a very short time.   Then you eliminate 50% of the 50% that’s causing the error.  So, in two steps, you’ve narrowed the area to look in by 75%.
Intentionally cause an error that stops the code.  If you can determine that the code is working up to a very specific point, then the next line of code is probably where the error is.  So, I’ll intentionally add a non-existent function, that causes an error, in order to stop the code:  Like xyz();    If there is no “xyz()” function, then an error will occur, an error will display, and the code will halt.  If no other error happens before the forced error, then the code is working up to that point.  So, I very quickly know, up to what point the code is good.

Try/catch prevents the Execution Transcript from handling the error.  The Execution Transcript tells the line of the error, and gives an error message.  For "production" purposes, you must use Try/Catch to "Fail Gracefully", but for development, I often prefer to just look in the Execution Transcript.  But, this may be one of those cases where there is no right answer, and it's personal preference.

In very specific situations, I use the debugger to step through lines of code, one by one.  I rarely use the debugger, but in certain situations it is a critical tool and extremely helpful.  So, what are the situations that warrant using the debugger?
You are learning what a new method or property does, and you aren’t really sure what the method or property returns, or how it works.  When you see the results happen right in front of your eyes, then it helps to understand.
The program flow is complicated enough, so that you are having difficulty imagining how the code is branching, or checking conditions, and there are lots of possible outcomes that are difficult to evaluate all at once.  For example, when you see how three “OR” conditions are being evaluated in the same IF statement, and it’s not what you ever believed would have happened, it’s confirmation of what is actually happening.  There is a difference between expected and actual results.

Debugging Code triggered from a Google Form submission:

The Google Form is obviously in a different tab than the code editor.  When you submit the Form, you can VIEW the LOGS, and see the print out in the code editor, even though the code was triggered from a different browser tab.

You can halt the code anywhere you want to with a return statement.  Halting the code at a specific point can help you know up to what point the code is doing what.  If you halt the code with a "return;" statement, no error will be produced.  The danger in debugging your code with a "return;" statement, is that if you forget to remove it, there is no error telling you that something is wrong.  If there is a red error message telling you that the code halted on a specific line, then you know exactly where to go.  To intentionally create an error, you can call a non-existent function:

xyz();

You'll get an error message that it can't be found.

You can not add a breakpoint to code that has been triggered to run outside of the code editor.
Add a comment...
 
I'm using this script to copy data from sheet 1 (has formulas) to sheet 2 (static, historical information).  Is there anyway to make this script so the data is permanently copied to the second sheet, so if the data is deleted or changed on sheet 1 it stays static on sheet 2?

function CopyDaily() {
   var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('SHEET1');
   var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('SHEET2');  
   ss.getRange('C7:F27').copyTo(ss.getRange('G4:J28'), {contentsOnly:true})
}

Thanks!!
3
Javier Prada's profile photoMichael ONeal's profile photo
6 comments
 
Though we do not help for the accolades, kind words do incentivize plus they make me feel warm and fuzzy all over. Thank you +Alexandra Runyan​, +Michael Ellis and +Javier Prada
Add a comment...

Cameron Kluza

Education  - 
 
Hey all,

So I'm new to Google Apps Script, and programming in general. After having played around for a while, I'm starting to see some patterns, and I was wondering: what are classes in the first place? I see a list of classes and "methods" in the documentation, but I'm not sure how or what they or their function on a fundamental level. Are classes unique to Google Apps Script, or are they something in JS as well?

(Hoping Education is the right place to post this to).
3
Alan Wells's profile photo
 
Methods are functions that are inside of an object. It's just a different name to designate that the function is inside of an object. Objects are storage places. You can store text in an object. You can store an array in an object. You can store another object in an object, and you can store a function in an object and actually run the function by referring to in inside of the object.

Take a quick look at this:

http://www.json.org/

Classes are not unique to Apps Script or JavaScript. It's a "grouping". Like, all the methods that act upon a spreadsheet, would be in the SpreadsheetApp Class.

There are two basic syntax's to get elements into and out of an object. 1) the dot operator, and 2) square brackets.

And object is a storage place for "key/value" pairs. The value is sort of self explanatory, but the "value" can be a function. The "key" is also referred to as a "property". But then there is a distinction between a "property" and an method. An array doesn't have "key/value" pairs. And array has it's elements stored by index. And you are always guaranteed the order of the index in an array. You are NOT guaranteed the order of the data in a JavaScript object.

You will often see the terminology "object literal". All that means is that the object was constructed by typing it into the code, as opposed to building the object with code.
Add a comment...

Katie Regan

Education  - 
 
Brainiacs - is there a script or add-on already written so that when a user submits a form, they are automatically added to a calendar event that I have set up ahead of time? When teachers sign up for PD, I want them to be added to the event so they can quickly get the video link and directions to the location. I know I'd probably have to create an array with the calendar event ID's for vlookup? Any help would be great! Workflow issue! +Andrew Stillman +Spencer Easton +Bjorn Behrendt  +John Calvert +Jay Atwood +Kory Hopkins 
3
Katie Regan's profile photoAlan Wells's profile photo
13 comments
 
Here is a link to the development version of my Forms Add-on, Data-Director

https://chrome.google.com/webstore/detail/data-director-test-copy/pejpngffdgnjiefkjpoegpleadkipcnf?authuser=0

I'm working on features for the Calendar. I just created a new G+ community at:

https://plus.google.com/u/0/communities/102644684467105579105
Add a comment...
 
HI,
Can anyone tell me what are the limits for the GAS execution API ? 
We have limits and quotas in the console for other apis but not this one. Also how will the quotas apply if I publish the project as API executable having access to anyone and it runs the app as the user accessing it ?
1
Bruce Mcpherson's profile photoKarandeep Singh's profile photo
6 comments
 
+Bruce Mcpherson Alright. Thanks for your time and help.
Add a comment...

Christine Gray

Education  - 
 
Google Spreadsheet Question: If we want to use a spreadsheet to keep track of inventory for a school store (positive reinforcement store), can you add a script for plus and minus buttons in the spreadsheet or is there an easier way to add plus and minus buttons to keep track of inventory? #googlespreadsheets   #googlescripts   #gafe  
2
2
Christine Gray's profile photoBjorn Behrendt (EdListen)'s profile photoAndrew Hyland's profile photo
16 comments
 
+Bjorn Behrendt I am super excited! Thank you! I have shared a spreadsheet with you! Please let me know what I can do to help!! :)
Add a comment...

Holly Skadsem

Education  - 
 
Can you still use Pagemeister script? If not, is there any script with the same capabilities of making a copy of a google site template for every student?
1
Alan Wells's profile photo
3 comments
 
The pageMeister script is using "UiApp", which is deprecated.  Don't know if it affects the performance.
Add a comment...

Nichole Carter

Education  - 
 
Looking for a script to take form responses and populate another tab on the spreadsheet, like if a student says they are in grade 6 all their info is then populated on the 6th grade sheet?
1
Andrew Stillman (Personal)'s profile photoJP Alpano's profile photo
19 comments
 
+Andrew Stillman I Agree.
I would rather have all submissions in one central sheet.
Then make individual sheets for each grade using FILTER formula for values from the main sheet.
Add a comment...

Martin Hawksey
moderator

Education  - 
 
In case you missed....
 
In addition, the Classroom API is now supported in Apps Script, which lets anyone write custom scripts or publish add-ons for Google Docs, Sheets, and Forms. Check out the Quick Start to learn more. 

#gafe #googleforedu #googleappsscript
4
Add a comment...

Leo Saumure

Education  - 
 
Hey Everyone,
Just diving head first into Google Apps Script.

I am a self-taught Microsoft Access developer for ages, and have put together some really great projects. Now, as the non-profit organisation I work for expands and we are slowly starting to migrate away from Microsoft to Google Apps, I am really excited about learning how to develop using this technology.

I've gone through some Apps Script code examples, and as you probably all know...it ain't VBA. That being said, I'm raring to go, and hope I can take some of the foundations of development and apply it using Google Apps Scripts.

I hope you will lend a suggestion here and there when I get stymied.  
1
Michael Ellis's profile photoJP Alpano's profile photo
8 comments
 
+Michael Ellis Yes, that's him! :)  A great GAS contributor in the community.
Add a comment...