Members-only tutorial
Watch the video and get the practice sheet with membership.
About this Tutorial
Sheet Resources
Featured Formulas
Video Transcript
<div>0:00 So you want to get an array of cells Learn how to work with cells in your spreadsheet for better data manipulation. Opens in new tab into this prompt, uh, let me show you how. So basically, uh, remember asked, I'm using this code here to get API access to open And I want to actually call the cells Learn how to work with cells in your spreadsheet for better data manipulation. Opens in new tab into, to the prompt.<br>0:17 Uh, more than one cell, because I'll show you what we just do sheet.new. Uh, I'm going to use this exact script again.<br>0:24 Again, this is at www.bettercheats.co slash snippet slash open a iAPI prompt in response. You can find it, you can use it immediately.<br>0:32 But let's put it right into our app script Discover how to use Apps Script to automate tasks in Google Sheets. Opens in new tab . We're just going to go to extensions.
App script Discover how to use Apps Script to automate tasks in Google Sheets. Opens in new tab . And we'll paste it right in here.<br>0:40 And here we go. So we have our function Understand how functions work in Google Sheets to perform calculations. Opens in new tab . We'll paste it right there. Save it. Uh, what we do need to do is make sure that we have an API key and API key there.<br>0:51 I'll do that. And so what we might want to do is write an email to Ronald about the tool of the project.<br>1:00 And so let's say we have our AI prompt. I'm ready to go.
Uhh what we can do simply is AI call the AI function Understand how functions work in Google Sheets to perform calculations. Opens in new tab and say hey umm get right a short email uhh short follow up email asking this per.<br>1:22 This person and we can put in quotes here put a ampersand b2 ampersand uhh if they are done with the project.<br>1:35 Thank you. Named and here again we'll do ampersand and we can access individual one but maybe we don't want to do all of this and I'll show you how to do an array into the prompt uh in a second but let's just look at what this will do umm.<br>1:51 Let's see if it will actually do it. Right?
We are not really saying uh what you might think and there we go.<br>1:59 We got it. What you might think you had to do was something like equals ai, in cell b2. There's a name and in c2.<br>2:13 There's a project right in email about c2. The project. To the person b2. And what you're gonna get is nothing.<br>2:30 It doesn't know the cell uhh information. And it's probably gonna even give us a message like hey, I don't know what you're talking about.<br>2:36 Um, but actually here it's actually funny. It gives us an email back.
I'm thinking that we can put that stuff in there.<br>2:43 Oh, we can probably. That's for another video. But here, how do we get this whole range Explore how to define and use ranges in your Google Sheets. Opens in new tab ? Like I wanna do all of this.<br>2:48 All at one go instead of having to like copy paste this. I wanna be like hey. Here's the data Get insights on managing and analyzing data effectively in Sheets. Opens in new tab . Analyze it.<br>2:54 Uh, do what you want with it like- How do we get that array in here? And again, I can show you right here just individually put an ampersand around it.<br>3:03 Sort Find out how to sort data in Google Sheets for better organization. Opens in new tab of concatenate Learn about concatenation to combine text and data in Sheets. Opens in new tab together. We can also use concatenate Learn about concatenation to combine text and data in Sheets. Opens in new tab here. Uh, we can take exactly this. Right? Equals. A.I.
and write concatenate Learn about concatenation to combine text and data in Sheets. Opens in new tab .<br>3:15 Uh, and instead of the ampersands we're going to replace this with, uh, commas. And this is exactly doing the exact same thing as those ampersands, but we're using concatenate Learn about concatenation to combine text and data in Sheets. Opens in new tab inside of A.I.<br>3:28 Uh, our A.I. formula Understand the syntax rules for writing formulas in Google Sheets. Opens in new tab , and it's going to give us the exact same response. We're very similar, right? Um, depending on if you're changing your, uh, tokens here, temperature we can change this, you know, to .5, top P frequency penalty presence, we can do all of those things.<br>3:44 It's there. But how do we get an array? Let's say what, let's say instead of an A.I.
prompt, let's copy this entire thing.<br>3:52 Let's say we're going to write a prompt in here. We don't need, uh, A.I. prompt as the . thing inside. We're going to actually write variable prompt equals, I'm going to use something like this.<br>4:07 Uh. Right and email to each person in column one is the name and in column two is the project. Uh.<br>4:23 Asking about the status of the project. Again, you can probably write a prompt here, analyze this data Get insights on managing and analyzing data effectively in Sheets. Opens in new tab , give me the insights of x, y, and z here.<br>4:32 There's the data Get insights on managing and analyzing data effectively in Sheets. Opens in new tab , but where Discover how to use the query function with where clauses in Sheets. Opens in new tab is the data Get insights on managing and analyzing data effectively in Sheets. Opens in new tab , right?
And so instead of prompt here we're going to do prompt plus data Get insights on managing and analyzing data effectively in Sheets. Opens in new tab .<br>4:39 Actually instead of data Get insights on managing and analyzing data effectively in Sheets. Opens in new tab array, uh, data Get insights on managing and analyzing data effectively in Sheets. Opens in new tab array, let's call it. And now we need to create a data Get insights on managing and analyzing data effectively in Sheets. Opens in new tab array for this.<br>4:46 So what we're going to do here is. So we'll go array. Uh and here variable data Get insights on managing and analyzing data effectively in Sheets. Opens in new tab array equals and what we could do if we wanted to straight up just.<br>4:58 Give it something. We could do spreadsheet Get familiar with the basics of spreadsheets and their functionalities. Opens in new tab app dot get active spreadsheet Learn how to reference the active spreadsheet in your scripts. Opens in new tab dot get cheap by name. Uh in this case it's sheet one dot get range Explore how to define and use ranges in your Google Sheets. Opens in new tab and it's going to be the array in here.<br>5:12 Uh dot get values.
Okay what we're doing with get values Understand how to work with values in Google Sheets for accurate data handling. Opens in new tab it will give us an actual array. A of the values Understand how to work with values in Google Sheets for accurate data handling. Opens in new tab here so let's see if this works.<br>5:24 We're going to save this and instead of get all these errors actually because we want ai. We're going to call this ai array and we're going to.<br>5:36 Give it another thing I'm going to show you is this custom function Understand how functions work in Google Sheets to perform calculations. Opens in new tab at custom function Understand how functions work in Google Sheets to perform calculations. Opens in new tab because sometimes we're not going to remember how to spell this but now that we save that with that custom function Understand how functions work in Google Sheets to perform calculations. Opens in new tab actually let's make sure it saved yes.<br>5:48 Uh so and we'll take all of this instead of that we'll do a ai.
ai and there it is it's right there once we start typing it that custom function Understand how functions work in Google Sheets to perform calculations. Opens in new tab adds that ability it's really cool ai array actually equals ai array and here we'll do b 2 colon c 4 let's see 3 and see what happens what is the response that<br>6:10 we're going to get gonna get an error Explore common errors in Google Sheets and how to troubleshoot them. Opens in new tab range Explore how to define and use ranges in your Google Sheets. Opens in new tab not found line 34 tells us right here range Explore how to define and use ranges in your Google Sheets. Opens in new tab not found ahh one second ah for this actually I think we just we don't need the actual array here as an array we need it in quotes probably because ah it's just gonna fill it in let's see if it this works now loading<br>6:31 loading loading there we go so we got the answer right if we had some data Get insights on managing and analyzing data effectively in Sheets. Opens in new tab here we want to analyze me now have that array.<br>6:39 So again, we're using a right in quotes here that is key we saw that error Explore common errors in Google Sheets and how to troubleshoot them. Opens in new tab and we're adding that array here we're adding a get values Understand how to work with values in Google Sheets for accurate data handling. Opens in new tab just to get that values Understand how to work with values in Google Sheets for accurate data handling. Opens in new tab in a right and then push it into that prompt over here prompt dot ahh sorry prompt plus data array.<br>6:56 So I hope that helps that gives you a few ways to do this in just a few minutes.
Uh we were able to show you with impresand, with concatenate Learn about concatenation to combine text and data in Sheets. Opens in new tab , how to access some kind of cells Learn how to work with cells in your spreadsheet for better data manipulation. Opens in new tab and now we can put it directly into our function Understand how functions work in Google Sheets to perform calculations. Opens in new tab here.<br>7:13 So hopefully that gives you a few options on what to do.</div>