Members-only tutorial
Watch the video and get the practice sheet with membership.
About this Tutorial
Sheet Resources
Featured Formulas
Video Transcript
<div>0:01 Hi, so in some previous videos, we've created some interesting let's say, APIs, right? We've done this email to Sheets where Learn how to filter data effectively with the query where clause. Opens in new tab we use an incoming data Understand the different types of data you can work with in Google Sheets. Opens in new tab to a web app, your app.<br>0:16 Where Learn how to filter data effectively with the query where clause. Opens in new tab we take an email in and we save it to a sheet. We also have embedded a headline in a website where Learn how to filter data effectively with the query where clause. Opens in new tab we take data Understand the different types of data you can work with in Google Sheets. Opens in new tab from a Google Sheet and get it into a website.<br>0:29 Same with embed a number Explore how to manipulate and format numbers in your spreadsheets. Opens in new tab in a Google Sheet. So we have these functions Discover the power of functions to automate calculations in Sheets. Opens in new tab here.
In this video in particular, what we're going to do is we're going to create our own API.<br>0:39 We're going to do a do get, which is the ultimate thing that we end up using. It's a built in function Get to know what functions are and how to use them in your projects. Opens in new tab inside of Google Apps Script Dive into Google Apps Script to enhance your Sheets experience. Opens in new tab that all we have to do is literally do this five letters, do get, and then we can create our own API here.<br>0:56 So let me show you a little bit of what I'm talking about where Learn how to filter data effectively with the query where clause. Opens in new tab we're going to create an API where Learn how to filter data effectively with the query where clause. Opens in new tab there is a URL.<br>1:05 A completely open URL that we can send data Understand the different types of data you can work with in Google Sheets. Opens in new tab to and we'll get back some data Understand the different types of data you can work with in Google Sheets. Opens in new tab .
We're going to build that.<br>1:11 And I think what's going to happen, and I hope, that by doing this you'll see the inner workings of an API so that you will be better to, you will.<br>1:21 It will be better and easier for you to understand how to access APIs once we know what's going on inside.<br>1:27 So let me show you this one, which is from Google itself. It's a URL called s2.googleusercontent.com slash s2. And what we're doing is we're sending a domain name.<br>1:41 We can send any domain name. We're going to do Google.com here.
And it will come back with an image Learn how to work with images in Google Sheets and Apps Script. Opens in new tab , an icon.<br>1:50 So we have this literally it's just image Learn how to work with images in Google Sheets and Apps Script. Opens in new tab . Change. A formula Understand the syntax rules for writing formulas and functions. Opens in new tab that we're using right now, but the inside of it is this URL that exists and we just need to figure out what the domain is, right?<br>2:02 We're sending the domain name and we're getting back the image Learn how to work with images in Google Sheets and Apps Script. Opens in new tab . We can do this as well with Airbnb.com. We can do this.<br>2:09 With think CNN.com. Right? Any website that has a favicon, we're gonna go out, grab it and we're using this URL.<br>2:21 We're not going and scraping that website. We're not doing much of anything.
Except accessing this URL that exists. And that's what we're gonna build today.<br>2:30 I'm gonna need a few things. One is we're gonna have to go to extensions app script Dive into Google Apps Script to enhance your Sheets experience. Opens in new tab . First step. We already have it open here.<br>2:37 And the whenever you open this as you've seen previous in previous videos. Is a watch those other previous videos. I just mentioned embed a number Explore how to manipulate and format numbers in your spreadsheets. Opens in new tab in a website, text, email sheets, or any coding.<br>2:48 We're always gonna start with function Get to know what functions are and how to use them in your projects. Opens in new tab my function Get to know what functions are and how to use them in your projects. Opens in new tab . But in this case, we're gonna change this to do get.
We're going to add in a little something here.<br>2:56 We need URL, which is going to be a very variable. It says we're gonna grab a URL when we when we ultimately deploy this web app, which you will see later in this email in this not in this email in this video.<br>3:10 We're gonna do it very similar to this email to sheets because this is. A basically web app we've deployed and it is essentially API, but we're gonna do do get so I'm actually going to copy all of this.<br>3:25 We're gonna edit it a little bit. Yeah, we're gonna get. All of that and we're gonna get edit.
So first off, we do need this variable params because we need the parameters Explore how parameters work in functions and APIs. Opens in new tab of the URL.<br>3:38 We do not need email. This is going to be something we ourselves are going to set up right now. What this means is this params.email if you see in this in this URL here, after the favicon there's a question mark.<br>3:59 And then there's domain equals and we're just putting in the domain that we want.
That name the text domain, that's a parameter Get familiar with the concept of parameters in programming. Opens in new tab .<br>4:09 So ultimately, what we want to get is this URL is going to come with, have a URL and then a question mark and then some parameters Explore how parameters work in functions and APIs. Opens in new tab that we set up.<br>4:18 We are going to create, create this API from the inside. So instead of email we want to create a, let's do just a little text just a little text transformation.<br>4:30 Very simple text transformation. We're going to take any word that comes in. We're going to return a domain name, which would just add .com to it.<br>4:38 Super simple as an example of what we can do here.
So we're going to get word. That's it. We're going to have variable word here and that word we don't need to do anything with it.<br>4:54 We don't need to log this at all. We're not, we're going to make this super simple. We're going to return and we're going to create this output.<br>5:06 We're going to actually call it. This output and create variable output equals word plus dot com. That's it.
Now, this is super simple to show you the construct of this.<br>5:21 In this particular video, we may do more complicated APIs, but in this case, we're just at taking the word that comes in in our parameter Get familiar with the concept of parameters in programming. Opens in new tab , and we're getting pushback.com.<br>5:35 And if not, if there's some error Learn how to troubleshoot common errors in Google Sheets. Opens in new tab , we're going to try this? First, we're going to, if we get an error Learn how to troubleshoot common errors in Google Sheets. Opens in new tab , we're going to catch that error Learn how to troubleshoot common errors in Google Sheets. Opens in new tab and then we're going to return the error Learn how to troubleshoot common errors in Google Sheets. Opens in new tab .<br>5:44 So how we actually deploy this is Command S or hit the save project up here.
Wait a moment for it to save.<br>5:52 Now we have our API completely done, if you could imagine that. The next thing we're going to have to do is deploy new deployment and in this case we do need to do a couple of simple things.<br>6:03 We're going to create a web app, that is one thing. We don't need a description but we're going to do add.com.<br>6:11 We're going to execute as Understand the 'execute as' feature for managing permissions. Opens in new tab me. That's going to execute as Understand the 'execute as' feature for managing permissions. Opens in new tab me. But then who has access Find out how to manage access permissions for your Sheets. Opens in new tab as anyone? That is important to do.<br>6:18 If you want to keep this more secure, there are other options here.
But we're going to make this a completely open API.<br>6:26 So we're going to click deploy. In our construct of an API, we need to tell people what parameters Explore how parameters work in functions and APIs. Opens in new tab to use.<br>6:34 And once this updates, it does take a moment or two, the very first time you do it. When you manage deployments or you update this deployment, which we will do soon.<br>6:45 You will see that it takes much less time. So we need this URL and I'm going to open an incognito window.<br>6:52 I'm going to paste this URL here that we got. And at the end, I'm going to do question mark, word.<br>7:01 And we're going to say Google.
We're going to hit enter and see what happens. And what we get here is literally the response, Google.com.<br>7:10 So it has done exactly what we asked it to do, right? So let's look at this again.
We have asked it here.<br>7:17 We're entering the URL which is that web app URL Learn how to create and use web app URLs in your projects. Opens in new tab , we're adding the question mark and parameter Get familiar with the concept of parameters in programming. Opens in new tab word which we've defined right here.<br>7:24 And when we create this API we can save it ourselves, we can use this ourselves or if we wanted to publish Discover how to publish your Sheets and APIs for public use. Opens in new tab this API publicly.<br>7:32 We just need to tell people how to use this which is have this URL, this long URL here, at the end put a question mark and put word equals and then put your word and we'll add the .com.<br>7:45 So if we want to edit this, say we don't want .com, we want to edit this.
We're actually going to close that.<br>7:52 And we're like, actually we want .co. So I'm going to call this the .co API and we've saved it and now we deploy new deployment again.<br>8:03 You'll see here we can add a description. A new description. We don't need to, but we can say now it's .co if we want to.<br>8:10 All of these settings are the same and we just hit deploy again. That's it. This will update that web app URL Learn how to create and use web app URLs in your projects. Opens in new tab , but the thing is we need to get this new URL.<br>8:19 It's always going to be a new URL.
So now let's go to our incognito window, add question mark, word equals, and we'll say CNN.<br>8:29 And what do we get here? CNN.co. That's it. We have created a brand new, your own API. We've created an API, we can edit that API, we can add some text, text transformations, we can do some math if we want, and it'll export Understand how to export data from Google Sheets effectively. Opens in new tab ex- yeah, it'll return to anyone using this URL and in the way that we <br>8:52 have de- Thank you.</div>
Courses
Add Icons To Your Sheets With a Domain Name
00:04:21
Automatic Screenshots in Apps Script
Add Tasks to Google Tasks From Google Sheets
Tweet From a Sheet
Convert Google Sheets into a REST API
Expense Tracker Template with Data Entry Form Inside Sheets
Build a Book Recommender with AI in Google Sheets
Build a License Key Generator and API in 20 Minutes
Create Your Own API by Deploying a Web App
Access Free API's with Google Sheets
Use Random Quote API in Google Sheets
OpenSea Data Inside Sheets
Tag Emails From A List of Members in Google Sheets
Spreadsheet Automation 101 Lesson 4: Access APIs Introduction
How to Validate Email Addresses
Build Your Own Free Domain Availability Checker
Build a Job Status Checker API in 15 Minutes
Spreadsheet Automation 101 Lesson 4: UrlFetchApp
Spreadsheet Automation 101 Lesson 4: OmdbAPI get ApiKey, get Data in URL
Spreadsheet Automation 101 Lesson 4: OmdbAPI Parameter Picker
Spreadsheet Automation 101 Lesson 4: OmdbAPI get data in Apps Script
Spreadsheet Automation 101 Lesson 4: JSON (beautifier) and OmdbAPI parameters
Quickstart Tutorial OpenAI API in Google Sheets
Shaman: AI Blog Writer
ChatGPT Clone in Google Sheets Part 1
ChatGPT Clone in Google Sheets Part 2
How To Set Up Stripe Webhook to Google Sheets with Google Script
00:22:10
Create Instant QR Codes
Access the Dictionary API to get Definitions for Words in Google Sheets