Hey folks, I'm a super busy guy and you probably are too. You probably have a lot going on with kids going back to school, maybe some new projects at work. You've got open source stuff you're doing or a blog or a podcast or who knows what else, right? But you've got stuff going on and if you've got a lot of stuff going on, it's really hard to do the things that you need to do in order to stay healthy. And one of those things, at least for me, is eating healthy. So when I'm in the middle of a project or I just got off a call with a client or something like that, a lot of times I'm running downstairs, seeing what I can find that's easy to make in a minute or two, and then running back upstairs. And so sometimes that turns out to be popcorn or crackers or something little. Or if not that, then something that at least isn't all that healthy for me to eat. Uh, the other issue I have is that I've been eating keto for my diabetes and it really makes a major difference for me as far as my ability to feel good if I'm eating well versus eating stuff that I shouldn't eat. And so I was looking around to try and find something that would work out for me and I found these Factor meals. Now Factor is great because A, they're healthy. They actually had a keto line that I could get for my stuff and that made a major difference for me because all I had to do was pick it up, put it in the microwave for a couple of minutes and it was done. They're fresh and never frozen. They do send it to you in a cold pack. It's awesome. They also have a gourmet plus option that's cooked by chefs and it's got all the good stuff like broccolini, truffle butter, asparagus, so good. And, uh, you know, you can get lunch, you can get dinner. Uh, they have options that are high calorie, low calorie, um, protein plus meals with 30 grams or more of protein. Anyway, they've got all kinds of options. So you can. Round that out, you can get snacks like apple cinnamon pancakes or butter and cheddar egg bites, potato, bacon and egg, breakfast skillet. You know, obviously if I'm eating keto, I don't do all of that stuff. They have smoothies, they have shakes, they have juices. Anyway, they've got all kinds of stuff and it is all healthy and like I said, it's never frozen. So anyway, I ate them, I loved them, tasted great. And like I said, you can get them cooked. It says two minutes on the package. I found that it took it about three minutes for mine to cook, but three minutes is fast and easy and then I can get back to writing code. So if you want to go check out Factor, go check it out at factormeals. Head to factormeals.com slash JSJabber50 and use the code JSJabber50 to get 50% off. That's code JSJabber50 at factormeals.com slash JSJabber50 to get 50% off.
Hey folks, I'm a super busy guy and you probably are too. You probably have a lot going on with kids going back to school, maybe some new projects at work. You've got open source stuff you're doing or a blog or a podcast or who knows what else, right? But you've got stuff going on and if you've got a lot of stuff going on, it's really hard to do the things that you need to do in order to stay healthy. And one of those things, at least for me, is eating healthy. So when I'm in the middle of a project, or I just got off a call with a client or something like that. A lot of times I'm running downstairs, seeing what I can find that's easy to make in a minute or two, and then running back upstairs. And so sometimes that turns out to be popcorn or crackers or something little, or if not that, then something that at least isn't all that healthy for me to eat. Uh, the other issue I have is that I've been eating keto for my diabetes and it really makes a major difference for me as far as my ability to feel good if I'm eating well versus eating stuff that I shouldn't eat. And so, um, I was looking around to try and find something that would work out for me and I found these factor meals. Now factor is great because a, they're healthy. They actually had a keto, uh, line that I could get for my stuff. And that made a major difference for me because all I had to do is pick it up, put it in the microwave for a couple of minutes and it was done. Um, they're fresh and never frozen. They do send it to you in a cold pack, it's awesome. They also have a gourmet plus option that's cooked by chefs and it's got all the good stuff like broccolini, truffle butter, asparagus, so good. And you can get lunch, you can get dinner. They have options that are high calorie, low calorie, protein plus meals with 30 grams or more protein. Anyway, they've got all kinds of options. So you can round that out, you can get snacks like apple cinnamon pancakes or butter and cheddar egg bites, potato bacon and egg, breakfast skillet, you know obviously if I'm eating keto I don't do all of that stuff. They have smoothies, they have shakes, they have juices, anyway they've got all kinds of stuff and it is all healthy and like I said it's never frozen. So anyway I ate them, I loved them, tasted great and like I said you can get them cooked. It says two minutes on the package. I found that it took it about three minutes for mine to cook, but three minutes is fast and easy and then I can get back to writing code. So if you want to go check out Factor, go check it out at factormeals, head to factormeals.com slash JSJabber50 and use the code JSJabber50 to get 50% off. That's code JSJabber50 at factormeals.com slash JSJabber50 to get 50% off.
AIMEE_KNIGHT: Hey everyone, welcome to another episode of JavaScript Jabber. Today for our panelists, we have Dan Shappir.
DAN_SHAPPIR: Hi, all the way from Tel Aviv where it's finally winter.
AIMEE_KNIGHT: We have Steve Edwards.
STEVE_EDWARDS: Hello from Portland.
AIMEE_KNIGHT: Myself, coming at you from Nashville, like usual. And our guest today is Ben Collins. Do you want to introduce yourself?
BEN_COLLINS: Hi, thanks very much for having me on today. I'm Ben, and I'm calling in from Harpers Ferry in West Virginia. So just about an hour outside of Washington, DC. It's currently snowing here, so I guess we're wintertime here too. And I create online courses, write tutorials and teach workshops all around G Suite and Apps Script, which we'll be talking about today.
When I'm building a new product, G2i is the company that I call on to help me find a developer who can build the first version. G2i is a hiring platform run by engineers that matches you with React, React Native, GraphQL, and mobile engineers who you can trust. Whether you are a new company building your first product or an established company that wants additional engineering help, G2i has the talent you need to accomplish your goals. Go to devchat.tv slash g2i to learn more about what g2i has to offer. In my experience, g2i is linked up with experienced developers that can fit my budget and the g2i staff are friendly and easy to work with. They know how product development works and can help you find the perfect engineer for your stack. Go to devchat.tv slash g2i to learn more about g2i.
AIMEE_KNIGHT: Do you want to give us just a brief introduction to kind of start us off? What is Apps Script?
BEN_COLLINS: Sure. So Apps Script is an implementation of JavaScript with the express purpose of extending Google apps. So the classic example would be automating the actions in your Google Sheets. So maybe you want to record a macro to apply formatting across tables. You maybe want to create Google Sheets in bulk or email Google Sheets to people and those kinds of things. So wherever you want to either take a manual process and automate it or extend the functionality your apps or connect them. That's another great use case. You know, you might get your Gmail talking to your Google Sheet and vice versa. So all those kinds of scenarios is where Apps Script really shines.
AIMEE_KNIGHT: So why did they develop Apps Script? Why not just develop an API that sits on front of those things that you can use JavaScript or like an SDK where you can use like any other language?
BEN_COLLINS: Yeah, sure. So Apps Script actually just celebrated its 10-year anniversary a few months ago at the end of 2019. So it's been around a while. And I think they have APIs that you can connect to. If you're using some other language and you want to connect to G Suite apps, you can use the APIs they have. And so I think they built Apps Script. It was actually a side project that one of the Googlers started initially. And then I think they liked the fact that it made it easier for people who weren't developers to start using a little bit of code and extending their Google apps in much the same way that Microsoft Office has the VBA language to extend Excel and that sort of thing. So I think it came about a side project and then it took on its own life and grew into this significant project now that's used by developers as well as the knowledge workers, I would say.
DAN_SHAPPIR: Looking at from the side, I think this VBA similarity is really key. I've been in the enterprise world in the past, and VBA is really huge and a huge facilitator for the spread of the whole office ecosystem. So I think it was definitely this goal of creating a similar solution for the G Suite. And obviously, since the G Suite itself is cloud-based, and I guess they went the same direction with this. But yeah, I definitely think that. The catalyst was that similarity with the Visual Basic for applications.
BEN_COLLINS: Yeah, I think that Excel and VBA is sort of the most popular programming language in the world by some margin if you classify it as one. And so, you know, it was important that Google, if they want to really push G Suite as an alternative to Microsoft Office, that they had that functionality available so that the power users can build their own custom solutions on top of G Suite.
STEVE_EDWARDS: Yeah, let's talk about VBA. VBA brings back some memories, because I first really started programming with VBA and Access, doing Access database stuff back more years than I want to mention ago.
AIMEE_KNIGHT: What would you say is it most similar to as far as other languages? Is it VBScript?
BEN_COLLINS: No, so Apps Script is JavaScript under the hood.
AIMEE_KNIGHT: Is it like a subset of JavaScript?
BEN_COLLINS: It's sort of based on ECMA 3, if I'm pronouncing that right the previous older version of JavaScript with a few other newer features added. They're working on bringing up to ES6 level. So hopefully that will be something that comes out soon. So it's like an older version of JavaScript, if you like, that runs on Google servers.
DAN_SHAPPIR: That actually answers in advance one of the questions that I was planning to ask you because I was actually in preparation for the show, was looking at some videos and some samples. And it really did strike me that some of the newer constructs in JavaScript that I'm familiar with like stuff like iterators and stuff like that was kind of wholly missing from the examples. So now you've explained why that is.
BEN_COLLINS: Yeah, that's true. And you can develop locally and then, you know, and use all of that ES6 stuff and then use a command line tool to then port this across into plain old Apps Script. So there are ways to do it right now. But it's it means you have to have knowledge and skill to have that developer environment set up and know what you're doing. So it's not really in the domain of the casual user or the knowledge worker yet. So for that group, you're using just the plain vanilla Apps Script, which is the older version of JavaScript.
DAN_SHAPPIR: And one more question. You kind of mentioned that you can actually record stuff, let's say, in Google Sheets. Can you actually transform a recording of operations that you perform into Apps Script?
BEN_COLLINS: You can. Well, the recording actually generates Apps Script code. And you can go and then click into it and look at the Apps Script code that's being generated by the recording. So it's actually a nice way, if you've never coded before, it's sort of that stepping stone into writing your own code. But it doesn't write particularly high quality code, you know, it's very verbose and it repeats itself and all that sort of stuff. So you end up with, you know, quite long scripts that could be easily be shortened and made more efficient. But it's a good, the micro recorder is a fantastic way to understand what you can do with code and understand what automation is all about and how it can save you time. So it definitely has some real benefits there, especially if you've never tried to code before. I think that's one of the strongest reasons why Apps Script is a great first programming language because it's so easy to get started because you have no environment to set up. You just simply open up a Google Sheets or a doc, click a single menu item and it pops open in an editor and you can start writing code straight away. So it's a really, really easy way to start programming and you're also in this familiar environment and so that's a nice reason why I think it's a great way to start.
DAN_SHAPPIR: And I guess that like...Documents are stored in the Google Cloud. Your scripts are stored in the Google Cloud as well, correct?
BEN_COLLINS: They are, yeah. And they execute on the clouds of their server-side scripts.
DAN_SHAPPIR: I've seen the term serverless used in this context. Would that be a good definition of how this operates?
BEN_COLLINS: Yeah, I mean, it's serverless in the sense that you're not having to worry about that server in the background at all. You can just write the code in your browser click run and it does its thing without you having to configure anything in the backend.
DAN_SHAPPIR: So could I literally use this mechanism instead of AWS Lambda or something like that?
BEN_COLLINS: I wouldn't know. I mean, it would depend on the context, but it's not really in that sense. So most scripts you write are what's called container bound. So they're attached to a Google app. So you'd have your sheets and then you would the script file would actually be attached to that sheet and do stuff with that Google Sheet. You can connect to other APIs and things like that and bring data back to that sheet, for example, but it's container-bound, so it's attached to the sheet. You can write a standalone script to do certain things, like maybe it would live on your drive folder and you might write a script to generate both documents or that kind of thing where it wouldn't need to be attached to a specific document. But that's the sort of use cases there that your Apps Script is for.
DAN_SHAPPIR: So when script is attached to a particular document or specific document, does it actually also exist as like its own separate entity? How do I actually get to the script?
BEN_COLLINS: Yeah, it's a file in its own right and you can get to it in a couple of ways. So from your Google Sheets, under the Tools menu, there's an option for Script Editor. And if you click that, it opens up the Script Editor and then you'll see the Google Script file there. Another way is through your Apps Script dashboard, where all of your GS files, all of your Google Script files exist, and you can go through there and access them that way.
DAN_SHAPPIR: So normally would you have one script associated with one file where you put, let's say, lots of functions, or would you create, let's say, could I have for one Google Sheet, I could have multiple scripts associated with it? How does it do?
BEN_COLLINS: Yeah. So typically, when you're working with a very small program you will probably just have one single script file and all of your functions will be in there. And that works perfectly well, up to a few hundred lines of code sort of thing. And then obviously it starts to get kind of unwieldy. And so you can then separate and have multiple script files in your single, attached to a single Google Sheet. But what happens is at runtime, they all sort of become amalgamated into just, it's a single script file that the having them as separates tabs, if you like, within this script editor is just really for our convenience. So you have to still be careful with function names and that sort of thing across the different js files. But you can also have, you can have HTML files within a project. So for example, if you're building an add-on where you have a sidebar which needs some HTML or CSS, or even regular JavaScript or jQuery or something, then you can have HTML files. And you can have multiple HTML files then within your project as well.
STEVE_EDWARDS: So can you also do things like importing external scripts from a CDN? Like you mentioned jQuery. Is that built in or is that something you'd have to import into your project?
BEN_COLLINS: That's something you would import. And you can also import libraries, other Apps Script libraries to use as well. The performance is a little slower when you start to import those things. But you can definitely use them. You can definitely import other libraries and frameworks. Yep.
STEVE_EDWARDS: So you mentioned your Apps Script dashboard, I believe. You said there's one sheet where you can go to the Script Editor. Where is that? I'm looking around here and not seeing something like that. It's not something you'd find from your drop down of all your other Google services?
BEN_COLLINS: The address is script.google.com slash home. Let me see why you would.
STEVE_EDWARDS: Oh, I see. OK.
BEN_COLLINS: Yeah, so it's sort of like a kind of like a drive folder, if you like, for all of your Apps Script projects. If you have any triggers set up, which we can talk about in a moment, then you can manage them from here as well. So it's a place to manage all of your script files.
STEVE_EDWARDS: So if you go into a sheet and add a, you know, go to your tools and script editor and start creating function, is it going to automatically show up in your dashboard here then?
BEN_COLLINS: It will. Yep. Yeah. You don't have to do anything to add it to this. It just shows up.
STEVE_EDWARDS: Okay.
BEN_COLLINS: And you'll see that, you know, it has a, the little icon there. If it's the green one with the white cross on it, that's your Google Sheet with a little script file attached. That's the container bound example we've talked about. If you have a standalone one, then it's like a sort of blue box with a white arrow in to show you that it's just a script on its own without being attached to one of the apps.
DAN_SHAPPIR: Before we dive deeper into how it works, can you maybe give a couple of examples, both, let's say, let's go with one simple example, one sophisticated example of stuff that you might build using app scripts?
STEVE_EDWARDS: Dan, you read my mind.
BEN_COLLINS: Yeah, absolutely. Sure. Let me give you an example of something that I created for myself in my own work that's been phenomenally useful. So I teach these online courses, as I mentioned. And what I do is when students have finished the course, I send them a Google Form with some questions about the course to get some feedback. Sort of what did they think of it, what improvements might they like to see, and that kind of thing. And for a while, that was great, because they would fill it in, I would have rows of data then in my Google sheet. I could look at the data and the responses and then email the people back and say, thanks for sending me your feedback and to answer your question about what's next. Here's some resources or that kind of thing. But it was all manual. And as I got more students, it just got to a point where it became unmanageable because I would open this Google Sheets and there would be a hundred rows of data, of feedback and I'm thinking that's going to take me two days to reply to all those emails, I just don't have time to do this anymore. So what I did was write an Apps Script program that would take each row of data and it would take the column where I asked for their feedback, send that through to the Google Cloud has a natural language processing API, and it can send back a sentiment score of whether effectively was positive feedback or negative feedback. Then based on that, I can select from a sort of little library of pre-written email responses. So if it was positive feedback, I'd grab the positive one. If it was negative, I'd grab the one that corresponded to that and then create a draft email in my Gmail folder automatically for me with that bit of feedback and with all of the response the person submitted as well. So then what I can do is I can just go to my Gmail draft folder, take a look, and say, I've got 15 new email drafts here today from the feedback and I can just look at each draft in turn and actually read the feedback, the original feedback the student submitted, plus then this also generated response. And then on top of that, I can then manually add one or two quick sentences to say, on that specific point you mentioned is my answer, or answer any questions they have and still make it personal because I can add that little touch before I then press send. And so it's allowed me to go from just sort of not being able to respond at all to now suddenly having a system that's manageable where, you know, it just takes five or 10 minutes each day to jump in there, quickly check the sort of three, four, five, 10 emails and respond to them and send them onwards. So that's an Apps Script project that's really helped me in my business, actually, and that sort of I still use to this day. I mean, it's not hugely complex. That's a few hundred lines of code in Apps Script, just in a single JS folder that's attached as a container-bound script to the spreadsheet that receives the form responses. So it's nothing. It's not some sort of gigantic project, that one. So that's one example. Another example that I'm just working on, actually, for the last day or two is in Excel, what you can do, one of the things you can do in Excel is to filter tables by color. If you've shaded some of your values, let's say you've used conditional formatting to highlight all the values above a threshold, for example, in your table, and what you want to do is then filter that table down onto those colored values. Well, you can do that in Excel by saying filter on the color but you can't do that natively in Google Sheets. But Apps Script, again, comes to rescue and you can write a small Apps Script program again that just takes a look at the table, works out what the background colors are for all of the cells, applies a filter, and then just, and filters the data down onto that, the color that the user's chosen. So again, another little example there of something you might do with Apps Script.
DAN_SHAPPIR: So if we consider the second example, actually the one with filtering the colors. I guess that what would trigger that, would you would like it to be some sort of a menu option that you kind of add to the Sheets user interface or something like that. Is that something that you can do like associate an App Script with a new like button or menu item or something like that?
BEN_COLLINS: Yeah, yeah, absolutely. So you can create custom menus in App Script. So right up at the top of your Google Sheet, you have the file edit view and then over on the right-hand side, you can create your own custom menu as well. What you do is you use one of the event triggers to then, every time you open your sheet, there's an onOpen event trigger so that when the sheet opens, that menu is just loaded automatically, so it shows up right away for the user.
DAN_SHAPPIR: Can you talk a little bit about the event triggers?
BEN_COLLINS: Yeah, there's only a little bit limited in Google Sheets. Let me just bring up. There's that onOpen one that I talked about. So the other ones are things like when the sheet changes, that can trigger actions. So the values and cells change, triggers you to go and do something, or when the sheet's edited, and then a form submit, that's the other one. So there's really just the four. There's the on open, on edit, on change, and then when a form submitted. So that form submit is a super useful one that actually, in that first example I talked about, where the feedback submitted and it generates the draft emails that was using the form submits event trigger to kick that process off.
DAN_SHAPPIR: Now, again, with regard to that first example when you mentioned about reading the data and generating the email, and you talked about how you actually sent it into a Google service to kind of gauge, how would I say it, whether it was a positive or a negative response. Can you talk a little bit about that?
BEN_COLLINS: Sure. So that was actually one of the Google Developer Relations experts at the Google Next Conference demonstrated this solution where they took, I think it was Airbnb data, feedback reviews in a Google Sheet, and then they ran it through this cloud natural language processor. And what that does is just look at the string of text and using machine learning. And the nice thing is you don't have to worry about any of the machine learning side of things, unless you particularly want to. But you can just use this API endpoint, just send your string of data to it, and it'll send back a numeric score from minus one to plus one. It gives you quite a few metrics, but the sentiment there from minus one to plus one gives you a sort of extremely negative sentiment to extremely positive sentiments. And then you can use a numeric value, obviously, to then do something. Your terms sort of unstructured data into structured data, which you can then, if it's greater than certain thresholds, do certain things with it. And so that was the demonstration that one of the Googlers did at the conference. And it was really, really interesting actually. And it just gave me an idea of, I could use that same setup and system in this example.
DAN_SHAPPIR: And you access that through a RESTful API from within the app script? How do you get that?
BEN_COLLINS: Yes, yeah, exactly, yep. There's a URL fetch method, which is a way to go and call RESTful APIs and it can handle, you can sort of handle authentication and that kind of thing with it as well.
DAN_SHAPPIR: And since I see that AJ has joined us, AJ, don't you want to ask something about authentication with regard to all of that?
AJ_O’NEAL: Of course I do. What about authentication and all of that?
AIMEE_KNIGHT: AJ looks like he's having, or sounds like he's having lunch.
AJ_O’NEAL: No, I've got a cold. I've got a cough drop in my mouth.
AIMEE_KNIGHT: Apparently something's going around in Utah. Anyways.
BEN_COLLINS: So like is there a specific question or just a sort of a general?
AIMEE_KNIGHT: Sounds like general maybe
AJ_O’NEAL: it's authentication handleable and app.js
BEN_COLLINS: Yeah in apps for sure.
AJ_O’NEAL: It's so Sorry app script
BEN_COLLINS: you can connect to API's With a worth to there's an oath to library that Google actually crazy one of the Googlers Which you can just use in your projects and then it makes it very easy. It's just sort of a wrapper then you can it handles a lot of the behind the scenes stuff with the OAuth stuff. So you can set it up with the endpoint you need and the credentials you need, and then connect via OAuth. And what it does is when you first run the program, it'll prompt you then to authenticate that connection and log into that service, so that then you've created that authenticated connection to the API and you can get back your data or whatever it is.
DAN_SHAPPIR: Well, from what you've described, all the API that allows me to read and write from various documents in G Suite, obviously I need to be authenticated as a G Suite user. For example, if some action that I perform updates a document, those changes should be associated with the account of the person who is actually using the service, not necessarily the person who wrote the app script. So that's handled through that authentication API that you just mentioned? Or is that the same?
BEN_COLLINS: Connecting to the Google Apps, that's all built in so you don't have to write any code to handle authentication. But the very first time you run the program, it will ask you to authenticate the Apps Script file. And it'll tell you what scopes it has, what access it has, so you can authorize it and you know that this program can read and edit and create spreadsheets, for example, or it's going to connect to a Gmail or it's going to connect to a third-party service. And so before it will ever run anything, you have to authenticate the script the very first time you run it. And therefore, if it's a script you've not created yourself, you'll understand what it's trying to do before you allow it to do anything.
Wish you could speed up your release cadence and skip the rollbacks and hot fixes? What if you could move faster, limit the blast radius of unforeseen problems, and free up individual teams to deploy as fast as they can develop? Splits feature delivery platform gives you progressive delivery superpowers like the coupling deploy from release gradual rollouts with automatic telemetry to detect issues before they show up in operations graphs and the ability to prove whether your features are hitting the mark using real user data, not the highest paid person's opinion. To learn more and sign up for a free trial, go to split.io.
AJ_O’NEAL: So is this the authorization dialogue that comes up when you go to use a Google app engine, Google doc app, Google drive app?
BEN_COLLINS: Yeah, the first, it'll come up with a modal box and it'll the first one will pop, it will say which email address or which account rather are you using, do you want to authenticate with? So you click that and then the next one says, it'll say app script blah blah blah, wants to use the following scopes. I'm not sure exactly the wording it uses but, and then it'll say it wants to read, write, edit spreadsheets, it wants to get the Gmail and then it'll ask you to say, authorize or cancel. And so it's that same Google flow.
STEVE_EDWARDS: OK, so I'm looking at in your script editor here under the publish. There's four different options for deploying projects, so as a web app and API executable, the sheets add on and deploying from a manifest. So can you talk about those four options?
BEN_COLLINS: Yeah, so we'll start with the add-on. I mean, that's the one that I'm familiar with. So when you when you build a script, it's just like I said, it's attached to your sheets and you're the primary user and if you wanted to share it with someone, you could share that sheet. You know, they could copy and paste the code and put it into a different, their own sheet if they wanted. But if you really want to share something at scale, then you'll want to publish it as an add-on so that it goes into the add-on store and then people can actually download it and install it themselves, you know, without you needing to be part of that process or without any kind of sharing of sheets and that kind of thing. So the add-ons are actual, and these are verified by Google. Well, Actually, if you build an add-on just internally within your own G Suite domain, then it does not have to be verified by Google. But if it's one that's going to be external to that and it can be installed by anybody, then it has to go through a Google review process. That's sort of quite a drawn-out process. I've only ever created add-ons internally for my own, myself, and my G Suite, so I've never gone through that review process. But it does take a bit of back and forth, and they'll ask you to keep, you know, to keep maintaining the app and that kind of stuff afterwards as well. The manifest one, the only time I've used that one is, so Data Studio is another tool from Google that's a dashboarding tool, and it allows you to build these, you know, sort of like a tableau. It allows you to build very professional-looking and dashboards very quickly. So you plug your data source in at the back end, and then you can create all these charts and filters and things like that, and it's a really good way of reporting on your data. And one of the things you can do with Apps Script in that context is build connectors from Data Studio to third-party APIs. I mean, it's been a couple of years since I did that, but I think that's where you suddenly have to publish a manifest as part of that process. The other two I haven't really ever used, but you can set up your Apps Script to be effectively an API or actually publish it on the web for people to interact with through a URL that they would just go to that site and it's there.
DAN_SHAPPIR: I have a couple of additional questions. I guess I'll just shoot them off one by one. So the first question that I have is about versioning, I guess. It's what happens when Google releases? Well, they don't officially release a version because it's a cloud-based service. But have you run into situations where Google have changed something in the G Suite implementation, and you ran into backward compatibility issues, or some API broke, or changed, or something like that?
BEN_COLLINS: Yeah, it hasn't affected me personally, but they do. I mean, they change things fairly often, and they do deprecate old bits of the Apps Script. So the way the custom menus used to be done, the UI stuff used to, four or five years ago, was done differently, and that changed. And they bring new things on all the time as well. So the language is evolving and changing all the time. And the backwards compatibility is pretty good because it's this older version of JavaScript, like I said, and it's pretty sort of set, but they do chop away bits from time to time.
DAN_SHAPPIR: I understand. Okay, so basically you're saying that overall from your experience, things tend to continue to work. And if something does change, you have the time to get it up to the latest version by using a deprecated function for a while until it's gone or something like that.
BEN_COLLINS: Yeah, they do give you time to adjust. So, you know, Fusion Tables was an example recently where that used to be a service Google had where you could, it was sort of like, you know, gigantic versions of Google Sheets for storing data. It was used a lot by data visualization practitioners and journalists used it a lot, I think. And that was, I think, killed off in December just gone, but it used to be accessible via Apps Script. And so undoubtedly, there are scripts out there that were running using importing and exporting data from Fusion Tables. But they gave you at least sort of a year's notice on that one.
DAN_SHAPPIR: That sounds reasonable. Another question that I had with regard to the context in which I think you call them triggers are run. So I understand the triggers are just a way for you to specify like a JavaScript callback function and it gets invoked when some event happened, let's say in the associated document or something like that, correct?
BEN_COLLINS: Yeah.
DAN_SHAPPIR: Then you will get probably some arguments that tell you what actually happened or direct you towards the right place or something like that.
BEN_COLLINS: Yeah. So we talked about those event triggers, but there are also time-based triggers, which are another really useful ones. So it's like running cron jobs where you can specify to say, run your function once every hour to bring new data back from an API, or once a day, or once a month, or once a minute even. You can write a function and then set a time trigger there and get that running on your own schedule. You can also use Apps Script to programmatically create the triggers, and delete the triggers, and edit the triggers. So if certain things happen that you might want to then build a trigger that then kicks off that kind of process.
DAN_SHAPPIR: So let's say a trigger got gets triggered? Is there any mechanism that kind of what happens, for example, if let's say two triggers triggered in an overlapping manner? Like you've got a timed one and another one that's based on change. And one is started, it hasn't finished, and the other one gets triggered. Do they run simultaneously, or are they done sequentially one after the other?
BEN_COLLINS: So Apps Script is not asynchronous. So everything happens in sequence in order. So it would finish one before it would start the next. And really, they would run, but provided you didn't max out your quotas. So Google have put quotas in place for Apps Script, which are perfectly generous for, as a small user, you're not going to get close to probably hitting those quotas. But if you're building an add-on that's going to be used by 10,000 people at your organization, then it's quotas are something you would need to be cognizant of. So it's how much computing power you can use with your Apps Script files. So that might be something you would have to consider if you had a lot of complex triggers. Triggers are interesting, especially when you start to create them programmatically. I've had a few instances where I've set up and created a trigger, thought the code all looked great, left it running, and woken up the next day to sort of 150 emails informing me the script's broken the next morning and that kind of thing. So whenever, if your script fails to run and you've got it set to then notify you if it fails to run and you get your triggers wrong, then that can make for some interesting inbox disasters.
DAN_SHAPPIR: So talking about problems with your scripts, how do you actually debug your scripts?
BEN_COLLINS: So you have a basic debugger built into the script editor there, where you can put breakpoints in and you can look at the values of your variables and whatnot at the different stages of the function. So that's pretty useful. You can log your outputs that's putting in a logger.log. kind of wherever you like in your script to look at what's going on. And that's been the way I've done it, because I personally sort of I come to Apps Script not from a professional developer background, but from a actually formerly an accountant, so a knowledge worker background. And so the scripts I build are to automate things in G Suite like these ones we've talked about so far today. And so for my purposes, that debugger is adequate. For professional developers, they might be a little bit aghast at that. What's available there? I think it's something that the IDE is something that Google are allegedly improving, and we should be getting that again, hopefully this year. It's been talked about for a while, so hopefully it's soon.
DAN_SHAPPIR: I assume you write the code wholly within the browser, correct?
BEN_COLLINS: You do, but you can develop locally. So there's a tool called CLASP, which stands for the Command Line Apps Script Interface. And so you can develop locally using visual code, say, or sublime text or whatever it is you like and then use the command line then to push and pull scripts to the actual Apps Script file on Google service. So that's the way, if I'm developing a program that I know is gonna be a little bit more complex and it may be involve more than just a single GS, a single script file, then I might go down that route and set up a local environment because then you get, you just get all the benefits of using a proper text editor and what not, and also completes and that kind of stuff.
STEVE_EDWARDS: You're actually only editing the file locally, right? It sounds like once you edit it, then it's gotta be synced to Google.
BEN_COLLINS: Yeah, exactly.
STEVE_EDWARDS: So that it can actually run.
BEN_COLLINS: Yep, that's right, that's right. But you can then do your versioning control and upload it to GitHub and that kind of thing as well.
STEVE_EDWARDS: But that was one thing I wanted to ask about too. So if you're working directly on the server in the editing your code and the tool, I'm already blanking on what is called your script editor there.
BEN_COLLINS: Script editor, yep.
STEVE_EDWARDS: That really doesn't provide any sort of source control, right? It's just save it and it's there.
BEN_COLLINS: You do have a built-in version control there where you can, so you can name versions at certain stages. So maybe when you've got a stable working version, you might say that's described that version and save that as an actual version you can go back to if you want. It's definitely more basic than if you're used to Git and you're fully conversant with that, then you'd want to see implement that rather than just this sort of UI version that the script editor has. But it's still pretty useful there to have. There's also an add-on that you could employ in your script editor here that would allow you to push and pull direct from GitHub that I used for a while, but then again, it was fairly basic and you didn't have too much control over it. I found actually it wasn't useful enough to keep going with, so I stopped doing that. Then if I really want to upload to GitHub, then I'll develop locally use this Clasp tool to push and pull from my Apps Script servers and also at the same time, just send the files backwards and forwards to GitHub as well.
DAN_SHAPPIR: Another question that I had, you mentioned it in passing before. You said that all the APIs were synchronous. That's surprising for everybody who's used to be using JavaScript where everything is now asynchronous by default. All the APIs, even like the quote-unquote Cloud APIs or the fetches that you perform or stuff like that. All that stuff is totally synchronous.
AIMEE_KNIGHT: I'd kind of love to know how that works a little bit if it's using JavaScript too.
BEN_COLLINS: Yeah, so I'm not the one to talk to about the ins and outs of that sort of implementation and the real details there. But Apps Script is synchronous. So if you make that call to an API with your LFetch, you're going to wait until it's returned the data or returned an error before you sort of go to the next step of your script code.
DAN_SHAPPIR: Well, it's their engine. They can do whatever they want.
AJ_O’NEAL: Do you mean synchronous or do you mean sequential? I mean, because if you use fetch, I don't think fetch has an asynchronous mode. XHR does.
DAN_SHAPPIR: No, fetch in the browser is totally asynchronous.
AJ_O’NEAL: I mean, I'm sorry. I meant synchronous. I reversed it. My bad.
DAN_SHAPPIR: I looked at some of the demos that were online and it seems like it's called fetch, but it's not necessarily exactly the same thing as fetch in the browser. So it's implemented synchronously as far as I saw based on the examples. Also all the APIs to access the documents, which if you think about it, would also be a synchronous, in a quote-unquote regular JavaScript environment, are all based on synchronous APIs.
AIMEE_KNIGHT: I'm guessing, I mean, this is just like a wild shot in the dark, but I know like with a lot of N10 testing libraries, it's designed to be synchronous even though it's like actually making async calls in the background. So perhaps it's something like that, but it does sound like maybe we're getting into the weeds here a little bit. So which I would like to get into the weeds, but I know we probably need to get to pick soon too.
BEN_COLLINS: Yeah. Well, I think actually Chuck wants to follow up with an Apps Script professional developer to follow up on this one, this podcast. Hopefully you can have a part two when you can go really into the weeds with that side of things.
AIMEE_KNIGHT: Agreed.
DAN_SHAPPIR: And one more thing that I quickly wanted to ask before, and did we go to PIX or something like that, you mentioned building HTML. I saw some talk about HTML templates and stuff like that, but before that, when you build something using HTML with Apps Script, would it be like a standalone web interface that I literally open in the browser in its own tab like the sheet or document or something, or is it both?
BEN_COLLINS: Yeah, it's embedded in the sheet or the document as a sidebar is the way we're thinking of. That sidebar you can style to, you can add buttons and forms and embed videos and all the usual stuff there, and that's when you'd use the HTML and CSS to style it.
DAN_SHAPPIR: It's not really its own page with its own URL. It becomes part of like that quote unquote document or something like that?
BEN_COLLINS: Well, I wouldn't let me just see the publishers of web app. Either that might be where you can get it as a to have its own page there.
DAN_SHAPPIR: Okay. Then so it sounds like you can do both. Okay. Cool.
Hey folks, this is Charles Maxwood and I just launched my book, Max Coders guide to finding your dream developer job. It's up on Amazon. We self published it. I would love your support. If you want to go check it out, you can find it there. The Max Coders guide to finding your dream developer job. Have a good one, Max out.
AIMEE_KNIGHT: Dan, you wanna go first?
DAN_SHAPPIR: So I actually have one pick, but I think it's a big one. I don't think it's been mentioned in any of the episodes before, correct me if I'm wrong. It's the Web Almanac, a bit late to the game because it was released in 2019 and we're already in 2020, but it's such an awesome thing that I think it's definitely worth a mention if it hasn't been mentioned before. So the Web Almanac, for those who don't know, is this like huge online document. That's based on a ton of data that's collected as part of the HTTP archive. HTTP archive is like this thing that contains a database of something like 6 million websites, I believe might be mistaken on that, but they run a whole bunch of tests on the, on those. So they, they run syntactic, synthetic sessions where they download the content, the websites in different environments and look at how they behave how much JavaScript they might download, how much images they might download, you know, which colors they use, is part of their CSS and so forth. And they put all this information in database and you can run all sorts of interesting queries to see how, how the web works. And so they thought about a lot of these queries that might be interesting and useful and they ran them and then they collected all the information that they got as part of this web almanac. And it's really an awesome document. It's got something like 20 chapters, I think. I'm trying to open it right now, and for some reason, my web is kind of slow. But you've got a chapter about JavaScript and a chapter about CSS. So again, if you're interested in stuff like, what are the most popular colors on the web, you might find it there. There's a chapter of performance and a chapter of security. If you want to know, for example, how much. First-party scripts versus third-party scripts, which is the most popular JavaScript library. Let's see if you can guess. Any guesses? It's jQuery by far. In any event, a lot of really interesting stuff. If the web is what you do and the web is what you love, I definitely recommend checking out this document and I will share the link to it. So that's my pick.
AIMEE_KNIGHT: Awesome. Steve, you want to go next?
STEVE_EDWARDS: Yeah, so I'm going to go a different route and go with sports equipment. You know, I head to the gym just about every day, well, five or six days a week. And a buddy of mine from my CrossFit gym showed me this bag that he has and it's called a King Kong bag. It's the name of the maker. And it's like, they have these different athletic bags, they have backpacks and athletic bags. But as the name suggests, they're really, really strong, like military-grade type bags and you can get different sizes. But the cool thing about them is they have, they're designed really specifically for athletic gear. I do a lot of CrossFit, so a lot of CrossFit people like them. But it's got separate pockets for shoes and side pockets for holding different things. And they're sort of spendy. I got a medium-sized bag, not the largest one, a medium-sized bag. It was on sale for like, I think it was 110. I got it for Christmas. But it's the kind of bag that's gonna last you a really, really, really long time just because of how strong it's made. And it has, I believe, a 25-year warranty against any defects in it. Obviously, that's not gonna cover wear and tear or things due to it, but I've seen stories of someone broke a zipper and they'll send you a zipper or whatever. So really strong, a little more spendy, but I've loved it since I've gotten it. And kind of beg that it's gonna last you a long time and serve you well for storing all your athletic gear if you work out a lot.
DAN_SHAPPIR: Seems like one of those instances when you spend more and end up saving.
STEVE_EDWARDS: Yeah, absolutely. Because if you're not having to buy, you know, more bags because they wear out, then short-term expenditure for long-term durability.
AIMEE_KNIGHT: Awesome. AJ?
AJ_O’NEAL: I recently discovered photography, professional amateur, professional amateur photography. I haven't quite discovered it yet, actually. I'm still on the fris on the event horizon of discovering it. And there's like, you know, there's a million different camera brands and blah, blah, blah, blah. But Canon is just the one that, you know, most people have had, and some people are turning to Sony because they were far ahead of the game and doing 4k video. And Canon still really isn't there with something that's relatively affordable or that's critically acclaimed to work really well for that. But anyway. It turns out that a lot of what's different between one release of a Canon camera and the next release of a Canon camera is actually just the software slash firmware that's on the camera. So you can go back pretty much as far as the T4i, which is exactly the same as the T5i, other than a marking on the outside, a notch on the plastic case on the software. Like they're identical. There's no difference in specs or anything. And you can run the software called Magic Lantern on it, which basically somebody just exploited the firmware update option to make a small change so that it can run other software simultaneously. So the menu button goes to the Canon menu and the delete button, which does nothing except for in one particular case when you're in playback mode, will now open up the Magic Lantern menu and it gives you access to some features that basically make some of their super old cameras come alive with new features and stuff that you can do. And for a lot of them, I mean, like the megapixels between the old and the new are that different. And there, it's just the difference between the processor. The processor's a little faster, so it can handle a little more, but the sensor is the same. So anyway, just kind of a cool exploration into that. And I'm hoping to be able to create really cool photos for my blog of SD cards lay on the table or whatever, I guess. But Magic Lantern is pretty cool community, not firmware, but applet. I don't know what you'd call it. To go with a lot of, not all, but a lot of older Canon cameras so you can save a bunch of money, get one that's only a little bit older and it has almost identical specs and then kind of get the software upgrades through the side channels. So that's cool, neat thing I'll pick.
STEVE_EDWARDS: Yeah, that sounds interesting AJ, because I've had a Canon EOS Rebel for probably 10 years, I think, 10, 11 years. And I've thought about upgrading, but it sounds like, I mean, I've never even come close to pushing the limits on what my camera can do. But sounds like I could save myself a lot of money with something like this and just tweak some things.
AJ_O’NEAL: Yeah, well, you get features like zebra exposure and, of course, snake. No, actually, I don't know if Snake is part of what you get in the default bundle. It's like Pong, you know, that's important to be able to play that on your camera or not.
STEVE_EDWARDS: That's the main point of the camera, isn't it?
AJ_O’NEAL: Yeah, when you get bored, you just pull it out and play Pong. It just gives you access to some lower-level features. Like for example, in the T7i, you get 3x zoom, crop zoom. And with the T4i, which is, I don't know how many years earlier, but approaching a decade earlier, you can also get that because it was always a part of the camera. You just couldn't access it. And if it weren't for the issue of SD cards being way slower than CF cards, and so having to have a really recent camera to have an SD card with fast writes, if you have an old camera that has a CF card, you can actually write 4K video to a CF card with this, because it just allows you to bypass all the Canon digital processing and just, dump it out straight to the cart. So there's a number of, you can get 4K raw video with a lot of these Canon cameras using this thing. So in that case, like literally on the high end, you could be saving yourself thousands of dollars to get one of their pro cameras. That's like a decade old, start with that.
AIMEE_KNIGHT: I'm gonna do my pick really quickly. I've been doing like more mentoring lately. So it looks like a post as with a lot of things I get them from Hacker News engineer at Uber and his advice on mentoring. It's just developers mentoring, other developers practices I've seen work well. A lot of the stuff's pretty good. That's going to be my pick. Ben, you want to go?
BEN_COLLINS: Yeah. I work for myself, work from home, and one of the perpetual challenges is to be productive and not procrastinate. There's a little app called Cold Turkey that has just been pretty useful, especially in the early days, to block all the websites like Twitter and news and sports and all the places I shouldn't go when I'm supposed to be working. And so it's called Cold Turkey. It's super easy to set up and you can just set windows of time when you block the BBC Sports website, for example, or Twitter and that sort of thing. And so it's been very helpful to make sure that I get a good working routine set up when I'm working for myself.
AIMEE_KNIGHT: Nice, I guess that's it. Ben, thank you for coming. And-
STEVE_EDWARDS: Well, Ben, do you want to tout your stuff? Sorry, I didn't mean to-
AIMEE_KNIGHT: Oh, yeah, yeah, yeah. Yes, please. No, thank you.
STEVE_EDWARDS: You got your, it looks like your website and you've got courses and stuff on Apps Script.
BEN_COLLINS: Everything can be found at benlcollins.com. And that's the same for my Twitter handle is Ben L Collins. And on my site there at Ben L Collins, I have a free beginner Apps Script course sort of just to get you up and running. And it teaches you a lot of things we talked about today. And you work through the very basics, all the way through to building a little application based around a form and automatically sending emails. So like a simplified version of that example we talked about actually today. And yeah, so everything's at benelcollins.com. And thank you very much for having me on. It's a real pleasure to meet you all and chat about Apps Script and advocate for Apps Script today.
DAN_SHAPPIR: Yeah, it does seem like an extremely useful thing. I think that a lot of the stuff that we either spend much more effort than we should building, or alternatively don't actually build because we think it will take too much effort, can actually easily be done with the Apps Script and the G Suite. So it looks like a really, really useful thing.
BEN_COLLINS: Yeah, it's definitely worth some time investigating and seeing what you can do with it, for sure.
AIMEE_KNIGHT: Honestly, sounds like maybe a good place to start, too, for beginners.
BEN_COLLINS: It is. It definitely is. Yeah. Because you can build some fun, useful little tools straight off the bat that do useful things for you rather than just sort of some abstract example that you can't then go and use, you can build something that's actually helpful.
AIMEE_KNIGHT: Awesome with that, I guess we will say bye and we'll see you all next week.
STEVE_EDWARDS: Adios.
BEN_COLLINS: Bye bye, thank you.
Bandwidth for this segment is provided by Cashfly, the world's fastest CDN. To deliver your content fast with Cashfly, visit C-A-C-H-E-F-L-Y.com to learn more.