Members-only tutorial

Watch the video and get the practice sheet with membership.

See membership options

Add Tasks to Google Tasks From Google Sheets

About this Tutorial

Create tasks in Google Tasks from Google Sheets using Apps Script

Video Transcript

<div>00:00 In this video I'm going to show you how to add tasks from Google Sheets to Google Tasks using Google Tasks and the API and Apps Script Learn about Google Apps Script and how it integrates with Google Sheets. Opens in new tab .<br>00:08 Uh, what is cool about tasks is that they appear over here in this side panel Discover the side panel in Google Workspace for managing tasks. Opens in new tab . You can open it up and see this task has this check, not check box, but check circle.<br>00:19 You can add tasks here. We can add, uh, follow up, call, and add a date time, like the 17th. OK, and it's.<br>00:30 It's sort Understand sorting in Google Sheets for better data organization. Opens in new tab of like a checklist Explore how to create and manage checklists in Google Sheets. Opens in new tab , like a to-do list over here, uh, which is really awesome.

And it follows you everywhere in Google Workspace.<br>00:37 It can even show up on your, uh, calendar if you set the date and time. Very, very awesome, uh, to use, but very hard to use with Google Sheets because we have to use the tasks, uhm, uh, formula Get familiar with the syntax used in Google Sheets formulas. Opens in new tab , uh, function Learn what functions are and how to use them in Google Sheets. Opens in new tab here.<br>00:55 And the task service is also something we have to add to it. So we're using the task. It's API. We have an example here, uh, from Google Developers Help Apps Script Learn about Google Apps Script and how it integrates with Google Sheets. Opens in new tab .<br>01:07 And the key here is that we have to use this tasks.

We have to create a task on a task list ID.<br>01:17 So we're gonna create a task list, uh, and we're gonna insert that task, and then we're going to also check if that task list exists and keep adding to it if we want to.<br>01:29 So to start off, we're going to create a function Learn what functions are and how to use them in Google Sheets. Opens in new tab . We have the task in the function Learn what functions are and how to use them in Google Sheets. Opens in new tab parameters Understand parameters and their role in Google Sheets functions. Opens in new tab , and we want to also get a task list ID.<br>01:39 Let's create a task list and get that ID.

So, uh, one of the key things here once we are using tasks, over here on services, click the plus sign, add a service, and we're going to get Google Tasks.<br>01:53 This is needed because Google Apps Script Learn about Google Apps Script and how it integrates with Google Sheets. Opens in new tab doesn't actually have tasks until we add it here as a service. But now we can use this.<br>02:04 We need to do a little bit of window dressing and a little bit of grabbing information from the sheet.

What we want to do is add a task here, like we created a task, we want to delete, we want to maybe clean up inbox, and we want to know did we add it to the task.<br>02:23 Our user functionality is going to be we select Dive into the query select clause for advanced data manipulation. Opens in new tab the task, and then we want to add a menu up here that says just add to tasks.<br>02:32 So let's go and get a snippet for that on Open Snippets. It'll be the very first one here on BetterSheets.co slash snippets.<br>02:41 We can just copy this function Learn what functions are and how to use them in Google Sheets. Opens in new tab on Open. We can add that up here.

We want to create a task menu, tasks.<br>02:53 The first item is going to be add task, and actually we're We're going to call this. addTaskInRange. We're going to go function Learn what functions are and how to use them in Google Sheets. Opens in new tab , addTaskInRange, and we're going to need the few things.<br>03:13 We're going to need the task list ID. Let's get that, uhm, variable task list ID equals, and we're going to insert that later.<br>03:26 The task we're going to get from the active range Find out what the active range is in Google Sheets and how to use it. Opens in new tab . GetActiveRange, get, and if we can just get the value.

And so we're going to just log this to see, logger.log, variable task equals, and let's just see if this actually works.<br>03:53 We're going to save it, make sure it saves, close it, and we're going to refresh our sheets we have in.<br>04:01 Automation menu up here. We want to go to task, add task, and we just want to make sure we're getting this B2 authorized the first time we run it.<br>04:12 Allow. Let's look at our Apps Script Learn about Google Apps Script and how it integrates with Google Sheets. Opens in new tab again. And let's just run it again, tasks, add task. Shouldn't show us anything, but it should show in our log and executions.<br>04:28 Add task in range Learn about ranges in Google Sheets and how to reference them. Opens in new tab .

And there, we have our task. So we can get our task name just from simply grabbing the value from the active range Find out what the active range is in Google Sheets and how to use it. Opens in new tab .<br>04:41 But now we have to actually add a task. We need to actually get the task IDs. So let's do that.<br>04:48 Let's get, use this function Learn what functions are and how to use them in Google Sheets. Opens in new tab task list. Task list. And we're going to add a task list, but we want to, actually go and create a task list first.<br>05:03 Let's go to tasks. We have my tasks and let's create a new list and call it tasks for video. So now we want to get the ID of this task for video.<br>05:18 So let's run this function Learn what functions are and how to use them in Google Sheets. Opens in new tab link list tasks list. Run.

We have task for video is this ID. Alright. So we're going to make this pretty simple.<br>05:30 We're just going to. Add this ID here and we have the task add tasks. So we just need to run our function Learn what functions are and how to use them in Google Sheets. Opens in new tab , add task with task.<br>05:40 So now anytime we run this, let's say we want to clean up inbox, go up to tasks, add tasks. API to fail with error Troubleshoot common errors you might encounter in Google Sheets. Opens in new tab invalid JSON.<br>05:51 Ah, that's because we actually did not do this appropriately. Let's look at our add task. We need this. So task is going to be the title.<br>06:08 It's just going to be task. Task to add.

Let's name this task to add and we don't need any notes Discover how to add and manage notes in Google Sheets. Opens in new tab .<br>06:22 We just want a title. So we have to create this JSON here with this title task. Cool. Let's save it.<br>06:31 and try to run it again. Dismiss. And we're going to add task. There we go. Now our to-do list has clean up tasks.<br>06:42 But we have this section here. Do we know it's been added to tasks? Let's add next to it, so C3, uhm, and say yes.<br>06:53 So once we do this, we also need to get variable.

Range Learn about ranges in Google Sheets and how to reference them. Opens in new tab equals this, just get the active range Find out what the active range is in Google Sheets and how to use it. Opens in new tab , variable row equals range Learn about ranges in Google Sheets and how to reference them. Opens in new tab .getRow.<br>07:19 Variable column equals range Learn about ranges in Google Sheets and how to reference them. Opens in new tab .getColumn. Okay, now spreadsheet Get an overview of spreadsheets and their functionalities. Opens in new tab app dot get. ActiveSheet. getRange Learn how to use the getRange method in Google Sheets. Opens in new tab . We're going to use the same row.<br>07:38 The column will be column plus one. We're only going to do one and one. Set value, and we're going to put yes there.<br>07:46 So this is just simply saying go to the active sheet Understand the concept of the active sheet in Google Sheets. Opens in new tab , whatever range Learn about ranges in Google Sheets and how to reference them. Opens in new tab we're in, add one to the column, and set the value to yes.<br>07:54 So we can know we'll add yes. So let's go up to task, add task.

I think we have to do authorization Learn about authorization processes in Google Apps Script. Opens in new tab now because we might have added the spreadsheet Get an overview of spreadsheets and their functionalities. Opens in new tab to it.<br>08:13 Wow. Let's try it one more time. And there we go. We have a yes, and we have added yes. When we mark it off now, uhm, we can complete those.<br>08:25 But this is just for adding from Google Sheets into tasks. Maybe this is a list of tasks you need to add.<br>08:32 Uh, tasks is very interesting because you can only add tasks to your own task list. You can't add them to any other, any other people's task list.<br>08:42 So if you're managing your own tasks, this is very, very good.

If you're managing other people's tasks, this is not very good to use.<br>08:50 Uhm, other people can't see your tasks, and you can't see other people's tasks. So this is good if you want to have a nice task list that follows you everywhere in Google Workspace.<br>09:02 From Sheets, maybe you have some more information here. We can add much more information, as you saw. We can add notes Discover how to add and manage notes in Google Sheets. Opens in new tab , notes Discover how to add and manage notes in Google Sheets. Opens in new tab , and write notes Discover how to add and manage notes in Google Sheets. Opens in new tab here, and we can have notes Discover how to add and manage notes in Google Sheets. Opens in new tab , and notes Discover how to add and manage notes in Google Sheets. Opens in new tab , and we can get that from, let's say, we have notes Discover how to add and manage notes in Google Sheets. Opens in new tab here.<br>09:25 Let's do all of this up here.

And we're going to get variable notes Discover how to add and manage notes in Google Sheets. Opens in new tab equals spreadsheet Get an overview of spreadsheets and their functionalities. Opens in new tab app, get active sheet Understand the concept of the active sheet in Google Sheets. Opens in new tab , get range Learn about ranges in Google Sheets and how to reference them. Opens in new tab , same row, but we're going to use the second column, and we have to change this yes as well to the third column, so number Explore how to work with numbers in Google Sheets. Opens in new tab plus two.<br>09:56 So we have notes Discover how to add and manage notes in Google Sheets. Opens in new tab here, follow up, send email, clean up inbox, yes. Let's do this. Add yes needed for knowing if we added it or not.<br>10:11 Okay, so add yes. Let's make sure this is all saved. Tasks, add tasks. It'll just put yes here. Now, oh, we have range Learn about ranges in Google Sheets and how to reference them. Opens in new tab .<br>10:26 So we actually need one more thing. Notes Discover how to add and manage notes in Google Sheets. Opens in new tab . Notes, ah, get value we need to add to there.

Make sure it saves.<br>10:42 Okay, follow up. Now it will work. Add task. And we have follow up. Oh, we need to make sure column, what?<br>11:00 Oh, yeah, column three. So it's actually, sorry, column plus one. That's if we're adding this cleanup inbox. There we go.<br>11:15 That'll work now. Now, yes, do this is the notes Discover how to add and manage notes in Google Sheets. Opens in new tab here and the notes Discover how to add and manage notes in Google Sheets. Opens in new tab are here. Awesome. So we can add much more information for these tasks, just maybe a task name and then have some more information in the notes Discover how to add and manage notes in Google Sheets. Opens in new tab .<br>11:28 Hopefully this was helpful to you to add tasks to Google tasks. from Google Sheets. Bye.</div>

Courses