Perfect Use of AI in Google Sheets (Categorize Tasks)

About this Tutorial

Explore how to use AI for task categorization in Google Sheets, from setting up the environment to using a pre-made code template. Watch as we walk through the process, from generating an API key to fine-tuning the prompt for effective categorization of work and home tasks.

Final code is available in the sheet below. And the original template code is available here:
https://bettersheets.co/snippets/updated-open-ai-model-to-omni

Video Transcript

0:01 I think I found the perfect role for AI in Google Sheets, and it is doing this. It is categorizing tasks with AI.
0:08 Uh, and here's an example that we're going to do from scratch. I have not coded anything yet, but I'm going to use some boilerplate code that I've made in the past.
0:17 Uh, we have a bunch of tasks, and we want to categorize them. We're going these home or work. Uh, we want to manage our day and properly adjust our day for the right amount of work and the right amount of life stuff.
0:34 So, home Respond to emails is work. Clean living, home. Attend morning meeting is work. So, we've categorized a few of these, but we don't want to keep doing this for 20 of these or even 200.
0:48 Maybe we want to have a daily AI categorize these and then give us back, um, very quickly the amount of work stuff and the amount of home stuff.
0:57 Maybe we have a count or a dashboard we look at. But let's do this. With AI, again, I have not coded anything yet.
1:03 So, we're going to do this from scratch. But again, I have written some code here using the chat gpd or rather open AI omni model.
1:12 So, I'm going to copy this clip to the clipboard and we're going to use this. Uh, we're going to go to extensions Apps Script, paste this in.
1:19 What we need is, is an API key. So, I'm going to go grab an API key or actually create a new one.
1:25 By the time you watch this video, it's already done. We're going to do tasks. We're going to create our secret key.
1:33 This might take a moment. And there we go. We have a secret key that we can put either in our sheet or I'm going to put it right here in our code.
1:42 So, we do not have to go very far to use this. So, we're just going to do API key. We are going to add a little bit of information to this prompt.
1:54 What we want to do is add to prompt. We want to create ah some examples. So, we have these examples here and we want to write a prompt.
2:06 We want to say give us back the category of the task for example and we're going to say prepare breakfast.
2:21 I think home we said. Respond to emails. We're usually give this more structured task and category. Task. And then again.
2:46 Category. Can we work? Task we're just going to give it all these four examples category. Home. And one last example at 10 morning meeting.
3:06 Task. 10 morning meeting. Category. Work. So we have all of these tasks in the categories we gave them four examples.
3:20 And then we say task and we're going to append the task here. So instead of prompt we're going to ask for task.
3:29 And then we're going to say plus task. And then we're going to add a space and give us a category.
3:37 We need to add one more plus sign here. There we go. So we're putting in the task each time we're going to put in a prompt.
3:44 We have our API key here. Add to prompt. Actually this will just be prompt. We just need one prompt. There.
3:50 Now we just give it a task and it should give us back the category. So we'll write tasks here for the project name and let's check this out.
4:00 So again I gave it these four examples equals AI, A6, and let's see if it's working. Great. So it is actually giving us back the task and category.
4:14 I want to edit that. So give us back only the category of the task given. So save that. Let's copy paste this a couple more times and see.
4:26 It is doing it. And it is doing it perfectly so far. Let's keep going and see. Call a client is work.
4:34 Pick up kids from school. Grocery shopping. Let's give it some hard ones that are like on the Oh, yeah here.
4:40 It just said category work, so it doesn't work exactly 100%, but we can always look for this. Oh personal. We can say things like uhm only give back either.
4:57 Can't spell either. to either work or home. No other categories. Let's save that and see if these change at all.
5:08 This personal should, yeah, change. And so now we can quickly, quickly give uhm order a new thing. New desk, let's see if it does that.
5:24 Order a new home desk for home office for personal use only. Let's see what it comes up with there. Home, yeah, perfect.
5:39 So this category categorization is really awesome for AI to do for us. Again, this is a pretty simple categorization, but I think walking through this and getting this to AI with this prompt gave it a few examples.
5:55 It added a little bit of fine-tuning here, not actual fine-tuning if you're actually into AI. I didn't actually fine-tune it, but I actually just engineered this prompt a little bit more as I looked through a few of the first example, uh, results.
6:07 And yeah, I love categorizing tasks, categorizing things, uh. If we have more deeper categories, like subtasks, maybe we create an entire new AI, we can copy this whole thing.
6:20 And paste it again and call it AI to subtask, so take the task and assign it some other category in our sheet.
6:30 But yeah, this is pretty awesome. I love it. Um, AI I think is a pretty simple way to use AI and I think it's one of the best ways to use AI in Google Sheets.