Enhancing the Google Apps Script Developer Experience (Cloud Next '18)

Enhancing the Google Apps Script Developer Experience (Cloud Next '18)

Show Video

My. Name is granty Merlin I'm. A cheese feet engineer I could go you. Can tweet. At me at granting moment at this talk you can check out my github, github. Grant. So. Today we're going to talk about. An. App script overview then, we'll dive deeper into the app script tooling in, particular, there's, one tool called clasp the, app scripts Gila that was released just earlier this year and, then. Fourth. We'll talk about tie, scrip and local development how, you can develop a script outside, of script.google.com. And. Then lastly something I'm really. Something. I really love is github, and open source how. You can contribute your scripts, or, find, other people's scripts, on. Github. So. First an. Overview of Africa, so what. Is this app script. And what can you build with it. Well. So app script is a developer, platform for quickly and easily building, line of business applications that. Integrate with the piece with it. Features, three point three billion, weekly, executions, eight. Point seven million weekly, end users. 27,000. Weekly active domains and. 270,000. Weekly developers. Oscar. Allows you to increase productivity of, these. Apps for example make. Sales and operation teams more efficient with custom workflows and automations, then, leverage the power of Google with, 40-plus. Apps and services. So. Apps Script powers applications. So, these are just, a couple of, the applications. That you can enhance, with. Google, Apps Script so, for example you can create Google, Docs add-ons you can, create sheets, custom, functions, and add-ons form. Add ons just. Lost follow me announced slide-out, ons and. More. Recently Gmail add-ons as well, as as app. Maker for, building applications, and hangouts. Chat BOTS for. Automatically, replying. To chat messages. Fundamentally. Apps Script is a serverless, JavaScript. Runtime, 4d suite automation, extension. And integration. So. Let's dissect that first. It's serverless. So, that means you don't need a provisioning. Any servers, you don't need to worry. If your. Server. Is going to be up over the weekend it's all hosted in google cloud and it's, all managed for you.

Second. A scrip, is really just JavaScript so. Here's a function that, just. Opens, a. Couple. Menu. Items for, your Google. Slides add-on, so. Here you can see we're just writing a simple function it's, called on open takes a parameter, e and we're. Just using this, thing called slides app to. Get. The UI create, a menu. Lastly. It's integrated, with Google, so, all these. Google. Api's and, Google technologies, are, readily. Available within. Apps Script so if you're doing anything from methylating. Drive files sending. Emails with Gmail Google. Slides if you want to integrate all those services together it's, really easy, without script. So. Without, script you can build a, couple, of different flavors, of. Apps, Script tools so. The. Most popular one is AGP. Add-on so, these are like many applications, that live, inside of G suite and, you can publish them to the marketplace so that you can install. It, and. Distribute, it for individual. Users as well as your. Whole domain. Second. There are web apps these, are scalable. Web applications, for, internal, or public use so. If you want to host your own public. Web. Application, that uses G suite it's. Easily, publishable. With, a public URL. Lastly. It allows, you to build automation. So, these are like background workers, that can listen for changes for, example on edit when you added a spreadsheet or when. You open a Google. Slide, for. Example and they can take action on your behalf, it's really powerful. So. I'm going to write. Our first hello world application, together. Can. We switch to the. Monitor. Okay. See. I. Think. There's some difficulties. If. You don't mind holding on. I'm. Sorry. Can. You switch to the. Okay. Just. Curious how many of you have used Apps Script before any fashion. Awesome. So, that's everyone. How. Many have built. A addon. Like Google slides out on sheets at on. Ok. About half of you how many have built a web, application. Ok. Also have. Hangout. Chat BOTS. Awesome. 10 people or yourself. It's. Almost working. Black. Box with yellow. Frame. I. Swear. It works during. The tech. Jackson. Yeah. Sure. Okay. Yeah we can go back to that slide. I'm. Sorry I don't recall. Him off of hand. But. There's. Some numbers that Ted. Gave at his. Outstrip talk just earlier. How. Many of you are primarily. Code an Apps Script like more. Than Python, or more than Scala. Okay. So that's, about. Half two. Here. We have the slides. But. I. Can. Go without, demos. For. Now. So. Hello we're, together we're, going, to code. Hello world, using. Math group editor. Unfortunately. All, the, next slides are all live demos. So. I don't. Really want to it's. Not a whole lot of content on the slides. Yeah. Yeah we could do that. So. Yeah feel free to. Look. At these numbers and. Just. Bewildered. Be. Amazed by. The. Number of weekly, executions. Yes. Yeah. So that's a Google, Docs ad on the. I'm. Script team updated. The icons. Yeah. So. Yeah that's a bounce script to a Google Doc. And. Then there's maker then it's standalone scripts. That's. A good question so it. Doesn't dissipate, a Google applies, to any organization, so. Some. Good ways to share add-ons, would. Be if you have, a master, spreadsheet for example someone got a spreadsheet, that the whole company uses to attract bands, for example there's, a spreadsheet tracking, this event. You. Can add an add-on for that or a custom function and every. User of that spreadsheet will be able to use them. And. For. Add-ons. That you'd like to publish, for. Your whole company domain your. Whole G suite account you. Can as an administrator. Do to be the administrator for that account you can, allow. All. Spreadsheets. To have. Certain. Add-on installed, for example. Yeah. So, I hope. To talk a little bit about that. The. Whole publishing lifecycle. And how to promote that, on a bit later. But. So. There's a GC marketplace, in which, he can promote and. Share. Your. Add-on and upload. And, example. Images have. Like. YouTube videos attached showing. Off your add-on and so. I've. Seen a lot of, really. Popular add-ons, just. Have awesome. Full-page. Image imagery. And the star. Also. Including, your company, logos is often. A great way to. Promote. Your add-on and then. And. Then eventually it'll be featured if yeah, it's. Me also us. So. I'm. The. Slides are on the on the Chromebook and I, have some live demos on my Mac. So. I, have. A bunch of tabs open on, my. On. My Mac. Yeah. Yeah. Yeah. Thank. You, well. So. While I'm. Not able to switch. To my MacBook a lot, to continue. For. Now. And. Hopefully. We can get to the demos later. We'll, probably do that I'm back back to back I. Was. Thinking about that. Yeah. I, mean. If. Well. Rebooting, or probably, just simply doing it me, and sharing my screen.

Yeah. I don't. Know I. Have. Multiple. Yeah. This. Is. One. Of the types of, situations, you dream. Let's. Continue on I mean yeah I have a lot to talk about and. Who. Needs, actual. Live demos even though they're really cool, because. I love them. Hello, world, Docs, add-ons. Okay. I'm going to show the sheets Mac recorder. So. I don't know if don't, know but with. Google sheets you're, able to record. The actions that you do as a user and, you're. Able to record it into what's called the macro, which. Is basically a. Little, function that, you create and you, can duplicate, that across, spreadsheets, across. Different tabs and, you can assign it to a hockey, so. For example you'd have control. Apple, one, to. Be a hockey. That. Automatically. Formats. Your, spreadsheet, add, a header, maybe. Add. Zebra, stripes to. The spreadsheet formats, a couple numbers and. Once. You do that you, can do it you. Can save it as, an add-on and it. Can be used. Without with, all of your spreadsheets, or kids, binders just to that spreadsheet. So. At Dreamforce. Last, year I built a Salesforce, add-on that allows, you to import your self force opportunities, data. Into. Google. Sheets and, so. You, might have like, an ORM, or some. Other data. Service and you want to just get your data into Google sheets well. It's really, not that hard using, app scripts I want to library. And. I'm running a couple lines of code lines. Of code you can. Connect. With that API and then. Import. Your data into. A. Spreadsheet. I think. I. Actually. Have a Jeff of this. So. Yeah, there's. A little bit so. Yeah from. Your CRM you, can, take. Your data and, load. It into Google, sheets and. You. Can even manipulate, that data and. Return. It back into Salesforce, CRM. And. Then. And. Also since. Google, sheets is integrated. With. Google. Slides and the rest of Google products it's really easy to just, transfer. Like. For example charts, between. Gears spreadsheet, and here in Google Sites. Okay. Here we are at the start so, here this, is a Google, sheets out on you, allow Salesforce, to access your data and then, it'll. Allow. You to import your opportunities. Table from Salesforce, and, I'll load the data here. We're loading it at a slower speed but, in reality, it, could be faster it'll automatically, sorted, and, then from there you, can create a chart, because you're in Google sheets so. Awesome. You have a chart, you, can customize. It maybe tilt backsies or. Make. A bit bigger and. Then you can just copy with. Fancy. And then paste then. You have two options you can link the chart. So. That the data will. Be reflected. In this, chart or you can do, a static image of, just this chart itself. This. Question. I think we had a. The. Product manager Ted and that's a bit more about he goes an external, designer. But. You could, do. Nothing. Stopping, you from there yet in Africa.

Okay. Well. Yes. The ones once the authenticate, once, usually. With that flow you receive. An access, token and a. Refresh token and. It's. Free time so cool, part about the. App script off to library is that it'll. Store that data and. So. If you are currently, logged in. You. Don't need and you have expired, credentials. App, script will automatically, refresh the credentials. But. If you, for. Example like refresh, the whole page and you're on a whole new state, you. Can use a. Local. Storage for a strip to, store, your. Like, refresh, token for that user. Does. That answer the question. Okay. Thanks I, might. Try to hangouts, to myself idea. That. Someone brought up. Yeah, sorry. The. Developers, hub. Okay. So. The. Question was one is the developer hope going to be available so I think you're referencing. That G speed developers. Announced. By. Ted. So. I. Believe. The. Hub. Is supposed, to be announced today. And, lunch, today or this week and. B, live. Soon. I'm not sure, the, exact day. So. Are you sure you're not able to. Like. Use, any. Adapter, to display. My MacBook. Because. I'll. Try to hang out but. I'm not sure. So, let's start in the meeting. Okay. So. I'm trying the Hutt's, meat. Approach. So. We don't necessarily, meet. X. Is the cursor. Then. To, share screens. Hey. Where's, that. Right. Here. Okay. Present. Your entire screen. Okay, I think, that's my Mac I. Fullscreen. On the comeback. Okay. Yeah. Okay. And. You, can see my MacBook now, good great. Yeah. Let's. Hey. Okay, awesome. Hey. We, can solve problems together that's. An. Accomplishment. Okay. So now. I'm. Presenting. So. Here we are at the new app script dashboard so if you don't have any projects you will see this screen. How. Much time do I have by the way. I'm. 25 minutes okay I think I can do that, okay. So let's let's, go run through the demos really quickly and I'll try to talk faster okay, cool, so here. We have the Africa. Just. Plain screen. And. So. Let's spray our hello world together. Hello. World. Okay. Awesome. Let's. Just make sure we can do that, and. These. Icons don't render if you zoom in so. If. We do that we're. Running an outer function. On. Google servers and, it's. Just JavaScript. And, it's, rendering, hello world. I'm. Just going to use my Mac but cannot switch. Don't. Sirens okay. So. With Google Docs, you're. Able to create. Add-ons. Which are your side bars, for. Example if you have document. Like this, you. Still. See that bottom bar. Okay. Okay. So. You might have a document, like this and. You'll. Notice if. You go and, press, tools. And. Script. Editor this, is the access point for, getting into Apps. Script so. This right, here by clicking that button you're, creating a document, bound script this. Is is a script, project that. Will. Only work within. This. Document. But. The cool part is that you're able to access the properties from the document and manipulate, the document. So. For. Example. Called. It all cool. So. For example we can create a. Translate. Add-on. Which. Allows. You to. Translate. From one language to another so, here. It's. Bit of code but. A, lot, of its comments. So. I'll. Explain it after it works. Cool, so let's say, so. We just broke. Two files one, is code yes that's an absurd file and, then sidebar, dot HTML, that's, an HTML, file with, some, JavaScript. Inside of it so. If we refresh, this page. We. Should see. There. Should be a new. Add-on. So, a quick start awesome.

Let's, Start the QuickStart it's. Going to ask you where some permissions, this is the Google. Apps Script permission. Modal. Dialog, and. Say. Hey. Hi, grant. Can, I be your documents, can. I run some. Code as, if I was you and I, will, say allow, and. After, a couple seconds. I. Can. For. Example. Highlight. The whole, text. Translate. The. Text into, German. That's. Not gonna work but. For. Example if I want to. Translate. A. Sentence. And, is German. Not. Exactly sure. But. It. Looks correct. And. This is powered, by Google Translate. I. Want. To talk a little bit about the sheets macro, recorder. So. With, Google sheets. Just. Recently we, enabled. The. Ability to, record. Macros. In Apps Script which are basically little. Functions, that. You can repeat, multiple times so. For example here, I have, quarterly. Data for. Some of the. Users. For. My game. And. You. Can see I like q1. Q2, q3. They're. All different dates and, and all. Let's. Say I want to format, all these documents all these spreadsheets. In the same way well. So I can just go to, tools. And then, you'll see macros, and you. Can start recording a macro, so. Here. I'm. Going to use absolute, references. I'm. Going to create. A. Nice. Header and, then. Think. I want to. Insert. It I. Want. To format. Alternating. Colors. So. That my. Data looks really, nice and, so, on I just do that I can. Press save and. I'll see. This to a new number. Format. Sheet. It's. Option. Command. Option, shift 5. Saving. The new macro. And. I. Can go here and. Has. Band. Option. Shift if. It'll. Ask me if. I, allow, the scripts, to run. It. Allows, you know man sheets. That's, fine with me, and voila. It. Automatically. Does all Darshan's. Automatically. And. So, you can see. You. Can also let's. Say you don't like, that color or, something you. Can go into, your script editor and see. Okay. Well it changed. To everything to light gray but I want some color so I'm gonna do like. Green. All. Right let's do. Let's. See if I am can, also do a HTML. Like. CSS, colors but. There's some prefix. Also. A few. Different. Color, so. That's just one way you can use the macro recorder also, modify, your macros. Great. Okay. The, Google sheets. And Salesforce Allen demo I, said. This a little bit before. So. You're able to take your data from a CRM parse. It into Google sheets and go. Into Google Sites. Very. Google slides I don't, this. Was. Recently, allowed. Last fall and it. Allows you to. Sorry. Sorry, okay. Cancel. Thank. You ah. This. Is complicated. It's not prepared, for this. So. Google slides that on so last fall. The. Google slides team, announced add-ons, that, allows you to manipulate and, modify, your slides, allows. You to add new slides, modify, the content, etc. So. There's. Google. Slides translate. Add-on as, well I, built. That allows you to translate your Google slide deck from one language to another all. What, like Google Translate so as normal, you go to tools, and then script. Editor and now. You're in the. Scripting environment. For. Your Google slides. So. If you want to go. For. Example manipulate. Your Google slides we have a great, five minute QuickStart. That. I can do in 30 seconds probably, if. You, go. Fast enough so let's say you want to add progress, bars for, your Google slides so, here, we, have a video it's, me and Wes showing, how you can, do this but. You can also just copy. The code. Go. Into your script project. Paste. The code. And. Here. We're doing a couple things so let me explain the code a little bit first. Can you see this. So. Here we're declaring an, on an open function. There. So. This. Is a special function that in Apps Script that. Always. Runs whenever, you open a presentation, and so, what on open. Where you going to the have an event we're, not going to use that event though and. Then we're going to say slides, up don't. Get you I thought. Creeped out on menu, then. From. There we're creating a new custom, add-on and menu and we're, going to add some items show, progress bar and, then pass, it the name of the method that we wanted to invoke. What. A user clicks that button I'm, also have, high, progress bar with, bleep bars, and. Then those are just normal, JavaScript functions, with. Some custom, Google slides. Okay. So. Here, first, when. We create the, bars we. Want to delete all previous, bars and then. We want to get the current presentation. Get. All the slides, see. How many slides there are have. A ratio, the. Current slide, over. The. Slides minus, one because it's. We're. Doing zero-based, indexing. And. Then, we'll. Have an x and y attribute, for. The actual bar. Rectangle. The bar width will be the. Width times. The ratio so, it'll be from zero to one and. Then we'll.

Only Show. Bars. That are non zero. Then. We'll just insert the shape which, is a rectangle, at the X Y and the, width, and height and. Then, like add some borders, and, set. Like a link URL, as. A custom. ID. So. Let's see this in action. So. Here. Thank. You refresh. I just, double-check. Pick. Out as I can. I. Should. Add some menu, items to. This. Presentation. Not. Seeing the correct ones. Yeah. That's, kind of refresh there but. Well. Yeah. Yes. I think it. Exactly. Sure why. It. Should prompt you for authentification. But. We can skip. Yeah. The. Trigger should just be on open so. That's. Fine you can. Slide. Great. So Gmail. Add-ons just came out. Last. Fall and they, allow. You to extend, Gmail. The. Native app from, Android. IOS and, web so. This is pretty unique in terms of batch script and. It. Allows you to. Customize. Your. Emails. So. So. Write once run. Anywhere on, web. Or mobile present. Below sign of a QuickBooks control etc how. About add-ons, that. Work. Across these devices. That. All structure. Is a bit like this, you. Have a header and. You have card, sections and. Section. Headers, etc. It. Works great this is the structured, UI, data format that. Works well across devices. Here's. Some example add-ons so, if, you use github at all you, can write an add-on that, touches. Metadata. From github Cydia and provides. Things like, data. On. Who. Reported, an issue when. It was last updated etc. Another, one that's useful if you, schedule all a lot. Of meetings is. The. Meeting assistant, you, can find. A, time, that works. For example if you want to schedule a meeting with four, clients. Jane. Bob, Mary and Sam for, 30 minutes and. Start. After. 8. O'clock and, and before 6 o'clock it'll. Provide, you. Ways. Example. Times that'll work and you can scope you, can schedule, a. Calendar. Event right there and. You can try these demos. Out on. Github.com. /g. Suite devs /. Gmail, add-on samples. So. I don't have, a. YouTube. API sample. So. For example I, play. The saxophone and. I. I've. Been looking at YouTube. Videos, for the saxophone, recently. And, so. I've. Got a little demo that shows just. How, you can use. Some. Google technologies, for example using, the YouTube API and the. Google slides II yeah to. Query. YouTube and, see. To. Query specific. Songs and then. Put, all those songs into a slide, presentation. So. This really features, Google. Advanced services, so you'll see under, resources, advanced services.

You'll. Have, all these different types of advanced services, which. You can they enable. Right. Now I'm going to enable the YouTube data API, that. Allows you to query YouTube. Like. YouTube data. So, here. We're. Just in the Google cloud platform in, console this. Is the standard way you can. Enable a Google API. And. We just got there through this little link. Right. Napkin. So. I will say okay. Cool. We have no data usage, now. Let's go and create some slides so, now if we can just press the Run button and this. Will be running on Google servers they'll. Say. Hey wait. Who. Are you. We. Need to go and. Allow. You to view and manage your Google slide presentations, and, even be, your YouTube account or view, a YouTube, account so. This. Will run in the background and. While. We, wait I can explain a little bit of the code yeah. Two. Methods one is get youtube videos. Jason the, second is create slides, the. First one will just query the YouTube API, for, an ID the, second will get. The YouTube videos and, create a presentation. And. Here. We'll. See fresh. Stock. And. Voila. We. Have a, lot, of saxophone, tutorials. So. This. Is a little a, little, demo of how. You can just make, something that's interesting. For yourself. Hope. You enjoyed that I. Am. Running out of time so I'm. So sorry but. I have. To just talk mostly about these next. Few, things so there's a lot of Africa tools that you. Can utilize. What. Is the cloud IDE that I just showed the. Dashboard, I could I briefly, mentioned stock, driver logs allows you to have, persistent, logs all. You have to do is write. Console, dot log and, then, in, your project, you can go do you stock. Driver logs and see, logs lastly. Is the apse, lie so. The, API. And, CLI were just announced, earlier this year and they allow you to manage scripts from the command line. The. Dashboard, allows you to manage executions. Sack. Driver logs allow you to see persistent, logs. Hey. Conscripts. Eli so, this allows you to create app scripts from, the command line so let's say you don't want to use, script. Google.com, you just want to use like I term or your simple, clean line tool, well now you can using. Class. Just. Npm install Google. Clasp. And you're. Able to create pole. Punch clone deploy, and even be logs built, off the bat scripts Eli here's, a little timeline of, the, off stream CLI an API res announced, so. Is released early this year I said. Internally. Cost, was, built, upgraded. To typescript, in March. Then. Later, in May, you. Were able to list, projects these dr. Borlaug's auto sync ask your files even, have custom root directories, with, your, command. Line project and, today I'm really. Happy, to announce that there's, going to be typed script support, in the app scripts II a lot so. This is really huge especially, if you're an ass Tripta belapur and you, really, want modern technologies, in modern ruling. Like. Ted trip so. So. Allow, you to facilitate, my combining. Code and use. Your personal IDs I. Really. Don't have time unfortunately, but. There's, good quotes, you'll. Have to believe me. And. So. Again, there's, tech script support this, is new, I literally. Just made. The commit like. Two. Days ago it. Allows for local, auto completion optional, typing, typing, prints etc. Don't. Have time for the demos but here's. Some the benefits. Have. Optional, typing. Access, to es6, and some features support. And. Then lastly, I, just want to talk a little bit about github and open source so, I'm, scrip has an amazing, community people. Who. Contribute. On Google+. As well as contribute, to our app your samples so here we have over. 1200 stars on our app script sample repo alone, and. This shows you how to do everything from use the admin SDK calendar, classroom, Docs drive form, sheets gmail, slides, tasks and, a bunch more it's. Also open to pull requests. So. In, summary. There. Are a lot of tools, that are helping, target. Professional. Developers, of the Apps Script team and, art. That. I'm working on and. So. With. The. API class, the, new dashboard and, open. Source we really, hope that there's. More, that you, can leverage when, you're building your app projects. This. Is what we talked about I. Guess. Turns out Google, comm you'll. Be able to find these slides later, on. My personal. Grant. Slash talks. Thank. You.

2018-08-12 18:16

Show Video


It would be nice with a re-make of this video.

Other news