Members-only tutorial
Watch the video and get the practice sheet with membership.
About this Tutorial
Sheet Resources
Video Transcript
<div>00:00 We're creating a tracking form on a website that allows you to have a sheet like this with tracking numbers and statuses and someone is going to search for a tracking number Learn how to effectively use numbers in your Google Sheets projects. Opens in new tab you give them and they're going to get the status.<br>00:13 You can update this Google Sheet in real time and they can go and check the form on a website and find the status at any time they want.<br>00:21 So, you don't have to keep people up to date on the statuses every time they ask, they can just check it.<br>00:27 So, we'll see 987-654-321. We'll go to our sheet.
They'll be able to enter a tracking number Learn how to effectively use numbers in your Google Sheets projects. Opens in new tab on this Google site that's actually free.<br>00:38 Sites.google.com allows you to create free websites. We can track it. See status delivered and that status is here. So if we.<br>00:48 Check 456, blah, blah, for pending. Is it pending? Let's go check that tracking number Learn how to effectively use numbers in your Google Sheets projects. Opens in new tab track. And there, it says pending.<br>00:59 So anytime someone wants to find out where Understand how to filter data using the query where clause. Opens in new tab their item is, they can come here and try it out. So I'm going to show you how to create this step by step.<br>01:10 The steps we're going to do is we're going to create this sheet.
So we have a sheet with our numbers in it.<br>01:16 We're going to create a little bit of an API that is over here. All of this we're going to do in this video.<br>01:23 That's the main part of this video. And we're also going to create a Google site where Understand how to filter data using the query where clause. Opens in new tab if you're watching this on bettersheets.co, you can get this exact HTML and this is the embed for it.<br>01:34 If not, go become a member of bettersheets.co. right now. So that's the three steps we're going to do in this video.<br>01:41 We're going to create the sheet here. We have items, tracking number Learn how to effectively use numbers in your Google Sheets projects. Opens in new tab , and statuses.
The big issue here is to make sure your tracking number Learn how to effectively use numbers in your Google Sheets projects. Opens in new tab and your statuses are aligned, right?<br>01:52 That their tracking number Learn how to effectively use numbers in your Google Sheets projects. Opens in new tab is aligned with the status. That's all we need for the sheet. And now let's go create the API.<br>01:59 So that's up in extensions.go. We're going to get through all of this, but for right now, when you open your Apps Script Discover the power of Apps Script for automating tasks in Google Sheets. Opens in new tab , it's going to look like this. Function Get to know how functions work in Google Sheets and Apps Script. Opens in new tab , my function Get to know how functions work in Google Sheets and Apps Script. Opens in new tab .<br>02:16 We're going to change this my function Get to know how functions work in Google Sheets and Apps Script. Opens in new tab to do get. This is a built-in function Get to know how functions work in Google Sheets and Apps Script. Opens in new tab with a capital G, make sure.<br>02:24 And we're going to the URL.
Essentially, what we're doing is creating our own API for this specific sheet that anyone can access anywhere.<br>02:32 And I'm going to show you all the steps in this video. So, what we're going to end up returning is return contentService.createTextOutputStatus. Now, faulting, meaning if nothing is found, we want variable status equals trackingNumberNotFound.<br>03:01 Now this allows us to say, you're going to get something out of this any time we access this.
We will need to eventually in this video, I'll show you the steps.<br>03:13 Deploy this, this is the big button here, deploy this as a URL on a web app and get a URL, but for right now, let's do all of the coding we need.<br>03:24 So we need a trackingNumber because this URL is going to be, when you submit the form, the form itself over here is going to have this trackingNumber and is going to send it to the API and set to, hey, what's the status of this number Learn how to effectively use numbers in your Google Sheets projects. Opens in new tab ?<br>03:40 So we're going to get the trackingNumber from that URL by URL. parameter Explore how parameters can enhance your functions in Google Sheets. Opens in new tab .trackingNumber.
Now we need to get the actual trackingNumber, SheetByName, and this is just tracking. This is just the tracking sheet itself. We want the statuses. Statuses equals tracking. getRange Find out how to retrieve specific ranges of data in your sheets. Opens in new tab . This is C colon C, and this needs<br>04:17 getValues Learn how to extract values from your Google Sheets efficiently. Opens in new tab . What's going to happen here is we're going to get a an array of the C column. All of the things in the C column is going to be in a single array.<br>04:30 We also want the numbers. Variable numbers equals the same thing. Tracking. getRange Find out how to retrieve specific ranges of data in your sheets. Opens in new tab , but B column getValues Learn how to extract values from your Google Sheets efficiently. Opens in new tab .
You change these two here, the B and C column, if you have different classification of your values Understand the different types of values you can work with in Sheets. Opens in new tab .<br>04:50 Basically, we're just going to look through the numbers column, find a match Discover how to match data across different ranges in Google Sheets. Opens in new tab , and then give the statuses back. So we have our tracking number Learn how to effectively use numbers in your Google Sheets projects. Opens in new tab not found, and now we create a for loop.<br>05:03 For i equals zero, i is less than numbers dot length, and and I++.
Now this for loop is, It's going to go through every single number Learn how to effectively use numbers in your Google Sheets projects. Opens in new tab here, these values Understand the different types of values you can work with in Sheets. Opens in new tab , this array, and if tracking number Learn how to effectively use numbers in your Google Sheets projects. Opens in new tab , this number Learn how to effectively use numbers in your Google Sheets projects. Opens in new tab we get from the URL, is equal to numbers i, and we're going to get just the item in that array, then<br>05:33 we're going to do something. We're going to say variable status equals. Statuses, same spot in the array, so this i, there you go.<br>05:44 So this is all we need, this is all of the code we need, before we deploy. Deploy, new deployment. We're going to deploy as Learn how to deploy your Apps Script as a web app for public access. Opens in new tab me, but anyone has access.<br>05:59 We'll hit deploy, and we're going to get a URL.
This is going to be a very important URL, where Understand how to filter data using the query where clause. Opens in new tab you can copy this.<br>06:04 Now what's going to happen is if we open an incognito window, and we paste this URL, and at the end we do, question mark, tracking number Learn how to effectively use numbers in your Google Sheets projects. Opens in new tab , with capital N, equals, let's go grab one of the tracking numbers, Let's see, 1, 4, 7. So see, this URL is just saying, hey, go to this URL, add the parameter Explore how parameters can enhance your functions in Google Sheets. Opens in new tab tracking<br>06:31 number Learn how to effectively use numbers in your Google Sheets projects. Opens in new tab equals this number Learn how to effectively use numbers in your Google Sheets projects. Opens in new tab . We're going to hit enter, and it says in transit.
So this is our API now, that anyone can access with any tracking number Learn how to effectively use numbers in your Google Sheets projects. Opens in new tab , but we're going to clean it up.<br>06:42 We're going to create it at the back of a form. So we're going to create a form that someone can enter their number Learn how to effectively use numbers in your Google Sheets projects. Opens in new tab in, and and get this response from.<br>06:51 We're going to show it nicely. But that's the general idea of this URL, and this web app. Make sure we have this URL.<br>07:01 We're going to grab, actually, just all of this URL up to exec. We can always get it from deploy, manage deployments.<br>07:10 Here, this web app URL Find out how to generate a web app URL for your Google Apps Script. Opens in new tab , copy that.
That's the URL for this, and we, this do get is really awesome, because now, we have an embed.<br>07:21 Now, this embed code, I've created it. It essentially is a form up here, just tracking, called tracking form. On submit, it's saying, fetch to the tracking status, and then here's this script that's written in JavaScript, that essentially says, go to this, uh, go to this URL.<br>07:37 Add this tracking number Learn how to effectively use numbers in your Google Sheets projects. Opens in new tab here, and then get the response, and add it to a little text here that says status.<br>07:45 That's it.
So, the only thing you need to change if you have this code, is right here, this URL, paste our new web app URL Find out how to generate a web app URL for your Google Apps Script. Opens in new tab , right here on line 13. Again, if you want this code, go over to bettorsheets.co and get it.<br>08:01 Everyone watch it. Everyone watching this on bettorsheets.co can get this code. I'm going to copy this, because we're going to go create a, let's delete that.<br>08:09 This is a Google site. We can get to it by site.new.2, just create a brand new Google site. That's all we did.
We didn't do anything else to this, and all we're going to do is on the far right, Embed code and paste our embed code, so all of this has been written.<br>08:30 Again, this is just a form with a status that literally, text that says status, and a script that says go to this JavaScript, go to this URL, and get the response.<br>08:41 Pretty cool. Hit next. It's going to look like this. Hit insert. We can extend this all the way up. Publish Understand the steps to publish your Google Sites for public access. Opens in new tab .
Click publish Understand the steps to publish your Google Sites for public access. Opens in new tab .<br>08:52 You're going to have to publish Understand the steps to publish your Google Sites for public access. Opens in new tab this publicly, and then we're going to get a link, publish Understand the steps to publish your Google Sites for public access. Opens in new tab site link, copy link.<br>09:00 I'm going to open, I already have an incognito open. Incognito is going to be easier to do. Paste this, so this is just a bettersheets.sites.google.com slash bettersheets.co slash delivering happy.<br>09:16 Enter a tracking number Learn how to effectively use numbers in your Google Sheets projects. Opens in new tab , and if we enter a tracking number Learn how to effectively use numbers in your Google Sheets projects. Opens in new tab that is, like, doesn't exist, let's see what happens. Not found.<br>09:25 So let's move this out of the way a little bit.
Go find a number Learn how to effectively use numbers in your Google Sheets projects. Opens in new tab that actually exists in our sheet.<br>09:30 Seven, five, four, three. Enter that. Out for delivery. So now that is done. We have our Google site, we have our API created, and our sheet.<br>09:43 Everything is happy. If you are trying to do this somewhere else other than BetterSheets.co, we just need a form and a script that goes to this URL.<br>09:53 That's it. That's how to create a tracking number Learn how to effectively use numbers in your Google Sheets projects. Opens in new tab getter in Google Sheets with a front end on a website that anyone can access anywhere.<br>10:04 We just did that in about 10 minutes. Hopefully you can do that too. Enjoy.</div>