Academy ↓
Hey there stranger!
Sign up to get access.
Ultimate Prompt Writer and Prompt Rater
About this Tutorial
Sheet Resources
Video Transcript
00:20 So in this video we're going to create a prompt here in B2. What I mean by that is that we are going to write a prompt here in B2.
00:21 And then we're going to insert a line each time so that our writing space is exactly the same place. And we're going to be able to rate these and that rating is going to stay with the prompt and the response as it goes down.
00:36 As more lines come inserted into here. Why I, The big thought of this is because I just finished a headline writing sort of ultimate headline writing sheet.
00:49 And I realized as I was doing that, that I was going from the top down and all of the writing and all of the prompt sort of engineering that I was doing, all of the, I did it on the next line down, down, down.
01:05 And so I had to scroll up through the past responses. I also didn't feel like, well, sorry. I knew that the way that I was using the, custom function of GPT, which again, in another video I wrote, GPT, the function that you can put all of the inserts in.
01:29 I realized like, one every time that is sits in a cell, you're going to get every 10 minutes it's going to do an API call.
01:38 That's just what happens. What we really want to do when we're writing AI inside of Sheets is we want to write the AI prompt, get the response, and done.
01:51 Right? There are some other situations we might want to create where we might want to create chains of prompts or sequencing or prompts in parallel.
02:00 That's not. Part of this video. This video is merely trying to figure out sort of a better interface for writing prompts.
02:08 And then also we want to be able to rank these and rate them and then ultimately rank them or understand what are the changes that we did to elicit this response.
02:18 Because I remember as I went through that headline video. Every time I would move a row or even add a column as I was creating that and adding more and more stuff.
02:29 The prompts were prompting again. And if you have like a. Your temperature, let's say is at one and you're like, I'm going to, it just indiscriminately reapplies.
02:42 The prompt to AI, the response you get might be different. It will make it different. So I want to see what happens the first time.
02:52 We can always regenerate the prompt by just generating the prompt again, the same prompt again and again, and see if there's different responses.
02:58 We can rate that say, Hey, there's large variability in this. Variability of, of format. And also why I talk about best or better, or when I say these words, it really means to you or like, if I'm writing it, what is best to me?
03:14 Does that mean that is it is consistent or is it inconsistent? Do I want more variability in the prompt? Or do I want more consistency?
03:25 In addition to that, is the response I'm getting what I expected? Yes or no? Or is it vastly different than what I expected?
03:34 Is it longer, shorter? There are so many ways to rate it. So in this case, I'm not going to show you too many sort of things.
03:42 I have some other videos about rating and ranking like rating domain names where you have a series of numbers that you sort of calculate, say the length of plus is it good?
03:56 Is it money-making? Is it interesting? And all of those are added together into one score. I have that in another video.
04:02 So I'm not. I don't think I can necessarily do that in this video. This video, we are just going to cobble together this app script that is going to call the API.
04:10 We're going to write this prompt here. We're going to move this prompt to down to, we're going to get the response here and we're going to be able to rate it here.
04:18 So watch as I do this. I'm going to, first off, I'm going to do a couple. Things to clean up the sheet or create our situation that we need.
04:26 We need the app script, which I haven't written a single app for app script for this yet. I also want to just go ahead and delete all of these rows and columns that are extra.
04:37 I do that now because I know I'm adding rows to this. I might actually end up adding columns as well, but for this particular instance, I know I'm going to be inserting a row right there above row four.
04:53 I'm also going to need to sort of set up the sheet I realized from for the prompt and for accessing AI.
04:59 I want to go up to extensions, tiny sheets, I need a one by one sheet. And I'm going to call this API key.
05:06 By the time you watch this video, I will have deleted this API key, so don't worry about it, you can see it now.
05:11 But this is where I put the API key. I'll put a little message that it's insert API key. We also need, we need that we have our app script.
05:20 I took it from if you watch the video upgrade. Google sheets, a open it, prompt to GP GPT for where you can be using GPT for and it is going to be a fuse.
05:34 We're just going to insert a prompt and get a response. I have sort of tokens at 2000. I have, I think all of the temperature I'm going to put to like point five.
05:43 I think I'm put. Okay. Everything to point five. We're not going to really mess around with that in this video.
05:47 So if we look at our code we also don't have any system message. It doesn't really need it right now.
05:54 But these are all types of variables that we can sort of look through and see if maybe at the end of this video, we'll go through some, go through them or in another video.
06:03 We'll walk through different versions of that. We did that in the headline video. So I don't really want to do that right in this video in, we're going to use the function GPT.
06:13 So that's all we need to write in our function here. We'll be able to write GPT, put in the prompt and get a response.
06:20 And this should be pretty cool. Right? We need. To execute some script here with insert, we're going to need a image as well of a button or chat GPT button, maybe.
06:34 Okay. So I got the background color of chat GPT. We might change this up here, but I just want to go insert an image over.
06:44 Okay. Else I'm going to grab the screenshot that I have here, put that in. And then we're going to ultimately assign the script here.
06:56 But I just want to show you this is what it looks like. We might end up changing this background to the whole thing.
07:00 Make it look a little bit more interesting or at least closer to chat GPT. Alright, so we want to see some interaction with this script.
07:08 We want to make a script. Let's call it chat. We'll have prompt. We don't need prompt actually here. We need variable prompt to be let's call our sheet chat down here.
07:23 And so we're going to do spreadsheet app. Dot get active spreadsheet. Get sheet by name. We're going to get the sheet chat.
07:34 I hope I even spill it. Yeah. All lowercase dot get range. We want the range to be B two in quotes B two dot value.
07:45 So we make sure that we actually get the value of whatever is written inside of B two. We want to run a variable response is equal to GPT prompt.
07:58 And this prompt will be whatever's a, this GPT prompt and get a response. We want to set that value. So one thing to, we want to do too, with the moment we press that button, we need to insert a row.
08:18 So we're going to do spreadsheet app again, dot get active spreadsheet. We want to get actually all of this again.
08:26 So we don't want to type this. We're going to do chat variable, chat equals all of this. Now go back here, write chat.
08:34 And now we don't have to write that all again. We can just do chat, dot get range. Our range, actually we don't need to do that.
08:44 Insert row. Before. And then what is the row we want to do it before? I think it's four. We can double check this for, yeah, we want to insert a row before four.
08:55 And then we want to go to chat, dot get range. We want, if we want to write in B4, right?
09:05 Every time we insert a line. All the other lines are going to go down and we're always going to have B4 here.
09:10 So we just can literally write before dot set value. And we want response. Literally the response we get from this GPT prompt and this function GPT.
09:21 We want to write it in B4. Is that what we want? Actually, no, we do not want to do that.
09:28 We want it in C4. Sorry. C4. What we want to write in B4 actually is what we have in is the prompt.
09:39 We want the prompt to be written there. Well, we have in B2. Let's go back and see. What we have in B2 we want written in B4.
09:46 Well, we get the response. We want it in C4. All right. Whew. That was a close one. Wait. Oh, we didn't do that correctly.
09:53 B4. Set the prompt, set the value as the prompt, and C4 set the value. So we're doing three things. We're inserting the row.
10:00 We are setting the prompt, literally just taking what's in B2, putting in B4, and then taking the response that we get from the AI.
10:08 And we're putting it, setting the value in C4. So we'll write, do command S. And our function has no variable in here.
10:16 It is just called chat. So we can ideally go to our button, go to assign script, and we should be able to just write chat.
10:30 Now what is the app script for writing to a cell? Let's just ask that here. Might want to wrap this all around.
10:44 And now we want to run this script. It's running the script. We do have to do authorization. One second. Once we did the authorization we had to run the script again.
10:56 It is running the script. It's taking a while. I think it might be because it's GPT-4. We might want to change this to GPT-3.5 Turbo, which was a little bit faster.
11:05 We got a response. This is cool. Let's, Let's double check. What is all of this? App, In Google Apps Script, you can use the following code to write value to a specific cell.
11:20 JavaScript function, writeToCell. Access the active spreadsheet. Oh, it has the code here for us. Wow. SpreadsheetApp. Get active spreadsheet. Spreadsheet.Get sheet by name sheet one.
11:32 Yep. We did all that. Set the row and column numbers where you want to write the value. Okay. That's, This is sort of too verbose, but variable value.
11:44 Then write the value to a specified cell. Yeah, it's sort of, Yep. You can do that. That's what we did, right?
11:53 It writes, hello world to cell A1 of sheet one. Yeah. Perfect. Not really, but I mean, it gets the job done, right?
12:01 If you were learning Apps Script and you're like, oh, how do I do this? Here they're, Yeah, now you can piece together all the pieces, right?
12:07 But like, Right now we're rocking and rolling, right? We have our prompt. We can maybe make a new chat, right?
12:19 Let's, What if we wanted to start like a, Not a chat. I'm not recreating chat GPT here right now. We want to rate these prompts, right?
12:30 We want this, some rating here, some system. So for my own sake, I'm going to create a dropdown. I'm actually going to create a, ratings here.
12:43 I only need one column. And I'm going to go good. Meh. Bad. Like the result was just bad. We're going to take this dropdown from a range.
12:56 We're going to call it ratings. Exclamation point a colon a. We can do that because it's only going to get the unique function, the unique versions.
13:06 We go back to our chat and we see good and bad. All right. Let's say, you know, this was meh.
13:14 Wasn't that great. It was good. Actually, it did exactly what we did. We needed, right? It was good. Yeah, pretty much good.
13:23 Let's see now if this dropdown copies over when we insert a row. So I want to do a whole. Another thing I want to just change it up and say what is.
13:35 App script. Just ask a simple question. And then run this script and get the response. I'm actually going to go after we do this.
13:44 I'm going to change. I'm going to change the tokens to much less because I want. It to be a little bit faster.
13:53 I want these tokens to be. It should be a very quick answer. So like 300 will save that, but it will give a verbose answer probably now.
14:03 Yeah. Let's call that. App script. Scripting platform developed by. Yeah. Cool. But you know, that's meh. I think this is a short prompt.
14:14 I think we can do way better. And I think we can also be better suited towards whatever we need. Right.
14:20 If we're creating headlines if we are creating headlines, we might include some examples. If we're writing some introduction, if we're doing some SEO optimized.
14:31 We are going to want to write much, much more in this prompt. We're going to write things. We're going to see that response.
14:39 Right. And we're going to see, is it different? I want to move this actually here. Actually, I want to make this much bigger.
14:46 Now that it made this, that looks weird, but it's fine. And you know what? But I will do this. I will change the text color to gray, change the background to this, change this background.
15:04 I want to change this background actually to white. I wonder if this is going to mess up anything. We'll see.
15:10 Change this text. I actually need it to be gray. There we go. Very interesting, right? Maybe we want titles. What is a good title for a video about writing the ultimate, ultimate prompt writer for AI in Google Sheets?
15:33 And we're just gonna get one answer here. We're gonna run this script. Oh, oh, we wanted to change the make it a little faster, right?
15:44 What is good to creating the ultimate? Okay, what is a good short title for a video? I'm gonna do more than short, but for right now, that's the only change I'm gonna do.
15:58 And let's see what it comes up with. Great, but I actually want to like two words. A good short two-word title.
16:09 Let's see if just adding those two words, literally the words two words, makes- a big difference. Prompt Wizard. Yeah, it does.
16:17 Makes three words. Good short three-word title. For a video. Maybe adding YouTube for a YouTube video about- Writing the ultimate prompt.
16:36 Ready for A.F. Let's see if that changes anything. Oh, nope. Doesn't change anything at all. Okay, this is, I mean, it's still meh.
16:50 All of these are right. And if we want to rank and- Rate these differently you're more than welcome to sort of rank and rate these in a different way, right?
16:59 We can put in a drop-down menu with like maybe a thumbs up, a thumbs down. We can then filter for all the like, good here.
17:07 And we can say equals filter. Range is going to be, All of that. And we'll say condition one chat a colon a is equal to good.
17:30 Yeah, let's change this one back to, eh, this is meh. Could have been better. But now we have no good, right?
17:36 So if we do if if error, let's just put an if error there. Now we have nothing but we are going to get the results here.
17:48 So we'll have prompt and response. This is only the good ones. We can delete all the other columns. We can even delete actually all these rows.
17:59 We don't need these rows either. It will add rows if needed. Delete rows. We want some more space. Let's get some good ones.
18:07 I think. What is a good three short, three word let's see if actually four word, short title for writing the ultimate.
18:15 Good examples. Include. Great way to go. I don't know. You would, you would put in whatever you want here. Nice looking sheets.
18:34 Daddio. That's one word. Daddio. Great looking. Let's do that. Let's give it a couple of examples. That is, those are not good, but let's see if it.
18:46 It's still going off of this A.I. Prompt wizard unleashed. What is a weird. Let's see if that's better. A.I. Writes prompt magic.
19:03 Okay. Let's just call it good. Let's call this one meh. Let's say, what is a silly forward title for a YouTube video, a YouTube to.
19:15 A tutorial video. Maybe that might help. More like educational. Let's see, A prompt wizardry unleashed. Okay. Let's just call this good.
19:26 Now we can see all of our good ones are right here. Our good prompts are here. Our responses as well.
19:32 And we're really rocking and rolling, right? We have a rating system. A very, a fairly simple rating system, right? Some three options.
19:40 We can see all the good ones. We can also duplicate this and say, what are the like the bad ones?
19:46 If there are bad ones, maybe we can see a difference between good and bad. And there are none, right? I think actually that was pretty good.
19:57 This one, let's call it bad for, there we go. So now we have a bad one and we can be like, okay, here's good ones.
20:05 Here's bad ones. We don't want to see the man ones. We want to sort of get through all the, like cut all those out.
20:10 We have, are using filter. We're using if error, if we have zero this is pretty cool, right? This is a pretty awesome way to be able to write some prompts, get better at prompt engineering, get better at prompt writing and see all of the examples.
20:25 I think the last thing we want to do is we want to be able to duplicate this chat. Maybe you want to start this all over and I would say one way you could do that.
20:37 To create more sheets, but let's just say we want different tabs for different prompts writing exercises, right? Maybe we're trying out different examples.
20:47 Maybe we try out different functions or a different model. I did want to change this to 3.5 turbo to make it a little faster.
20:57 So now that these are all these are all the using GPT four and now I want to use GPT 3.5.
21:06 Maybe I want to split them up a little bit. So let's make an extension app script that is going to duplicate the page and create a new page.
21:18 Function new chat. We'll call it new chat. I don't know if it's actually a chat. We want to take a variable chat.
21:30 We want that. Want that page and we probably want to keep the new one. Called chat and archive the other ones.
21:41 You know, like we want, we might want to take this. Go chat.copy2. Using copy2, what we can do is we'll copy it to this exact sheet.
21:52 So our destination is going to be this. Destined that she were in now. Spreadsheet. We need all of this. We can test this out.
22:09 Let's save this. We can run new chat. We probably, oh, we want to set the name. Set name. As a chat.
22:21 And then plus new date. We are going to get a bunch of formatted, non-formatted information here. So we don't really want that date.
22:32 We want. Second. Actually what we're going to do is we're going to test this out. We're going to take the date.
22:40 We're going to use utilities.formatDate. New date. GMT we're going to use for just the sake of using this. And so now we just do date.
22:48 . This is using the day. We might want to also add in the time. Especially if you're going to do multiple of these in sort of within a day.
22:58 But if you're like, you know. I'm going to come to this once a day. I'm going to try to little bit of prompted engineering and I just want to save it for each day.
23:06 Let's see what this runs. If we run into any errors, we will see. That in a hot second. And there we go.
23:16 We have our chat. So now we have copied what. We have done. We're not going to lose that we're going to copy that page, but what we might want to do is we might want to delete.
23:27 Rose five down and we want to clear out what we have in four and B2. OK, so in this new chat we're going to copy that first.
23:38 Then we're going to. Go to chat dot get range B2 right set value insert prompt here. And just give it a little message.
23:53 We're going to do chat dot delete Rose. And let's look at how. Delete Rose works. We have a row position integer and then how many?
24:05 This starts at one is going to delete the first one. Two is going to delete the first two rows. What we want to do is we want to do five.
24:14 We want to delete the fifth row and then down to. We need to know how many rows are so we're going to do chat dot get.
24:27 Max rose. So we know this variable. Rose equals that we're going to do rose minus five. I think that's what we have to do.
24:39 Rose minus. Go that many down. Right, let's see what happens right? We have chat. What we want is five down to be deleted.
24:52 We're going to go back to our new chat. We're going to run it again. Oh, we're going to get an error here because it already exists.
24:58 So this is the issue with having these. Only the date. Maybe we'll add the time back or we'll just delete these as we go.
25:11 Let's run that again. New chat. Let's see if we get any errors this time. No. On our chat. Oh, we have.
25:24 Something else here. Oh, this was probably the row. I think we had this row at the bottom. Here. Yeah, this is it.
25:32 Okay, so we did everything except the fifth row or the very last row. I think we need then to do minus four here.
25:39 Let's run. Let's run it again. Let's add some more. What happens if I want to delete or how do I delete rows in Google Sheets?
26:02 It's magic. Yeah, so we have a response here. Now we have five and six. We also want to write the code to clear A4, B4 and C4.
26:20 So let's do that. Check. Clear. Contents, I think. Oh, nope. Get. Range. Dot clear contents. So we're going to use range A4 to C4.
26:39 And that will hopefully clear out whatever left. Here, so we want to make sure to delete this one. It's going to have the same name.
26:50 Okay. Now we saved it and we run new chat. Do we get any errors? Yes, we get an error because.
27:04 Clear contents is not a function. Clear content. Okay. That is why. I think we also need to go and delete this.
27:15 Okay. Great. So we have all of this. Okay, we, it did everything except this clear content. Let's do that again.
27:24 Just make sure it will also do that. Those, yeah, because we don't have anything to delete. Okay. So we want to only delete the rows if rows is greater than four.
27:45 So we'll put a little gateway there. If rows this max rows, if it's over four, right now it's four, if it's over four, we want to delete everything from five down.
27:59 So we don't need that unless we have these rows. Cool. Let's save that. Let's f- run it again. Wait, no, we don't want to run again.
28:07 We want to go and delete this. Gotta remember to delete this before we do it again. If we wait a day to do it, it'll be fine.
28:15 Alright, let's run our new chat. We shouldn't get that error anymore. Great. Let's go to our chat. We have a clear thing.
28:25 We have our, dropdown still exists. We have a blank insert prompt here message. We are still running the script. I don't want to actually run that.
28:37 Ugh. Okay, that's what it did. Cool. I'm so happy we got this ultimate prompt write it down. We can, Great and rank our rate all of our prompts.
28:51 We can write them. We can edit them. We can see the difference between these prompts as we go. We can add much, much more.
28:57 We can add a bunch of characters into these. We can run, like, chat inside of Google Sheets. It was pretty cool, right?
29:06 Bye.
Courses
Quickstart Tutorial OpenAI API in Google Sheets
Upgrade Google Sheets OpenAI Prompt to GPT 4
Perfect Use of AI in Google Sheets (Categorize Tasks)
Quickly Integrate AI and Google Sheets
Saving OpenAI API Calls inside of Google Sheets
Build Your Own AI Writer in Google Sheets
Fast FAQS
Created a GPT function in Sheets
Spreadsheet Automation for Beginners
Ultimate Prompt Writer and Prompt Rater
ChatGPT Clone in Google Sheets Part 1
Mr. Beast Renamed My YouTube Titles
I Built a SEO Meta Description Writer
Create a Waterfall of AI Prompts and Responses
ChatGPT Clone in Google Sheets Part 2
Run 100 ChatGPTs at One Time
Prompt Parade
Building an AI Prompts Playground
YouTube Title Rewriter with GPT-3
Ultimate Headline Writer with GPT in SHEETS
Create a ChatGPT Cheat Sheet Spreadsheet