Academy ↓
Hey there stranger!
Sign up to get access.
Add Tasks to Google Tasks From Google Sheets
About this Tutorial
Sheet Resources
Video Transcript
00:08 Uh, what is cool about tasks is that they appear over here in this side panel. You can open it up and see this task has this check, not check box, but check circle.
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.
00:30 It's sort of like a checklist, like a to-do list over here, uh, which is really awesome. And it follows you everywhere in Google Workspace.
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, uh, function here.
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.
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.
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.
01:29 So to start off, we're going to create a function. We have the task in the function parameters, and we want to also get a task list ID.
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.
01:53 This is needed because Google Apps Script doesn't actually have tasks until we add it here as a service. But now we can use this.
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.
02:23 Our user functionality is going to be we select the task, and then we want to add a menu up here that says just add to tasks.
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.
02:41 We can just copy this function on Open. We can add that up here. We want to create a task menu, tasks.
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, addTaskInRange, and we're going to need the few things.
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.
03:26 The task we're going to get from the active range. 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.
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.
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.
04:12 Allow. Let's look at our Apps Script 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.
04:28 Add task in range. And there, we have our task. So we can get our task name just from simply grabbing the value from the active range.
04:41 But now we have to actually add a task. We need to actually get the task IDs. So let's do that.
04:48 Let's get, use this function 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.
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.
05:18 So let's run this function link list tasks list. Run. We have task for video is this ID. Alright. So we're going to make this pretty simple.
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, add task with task.
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 invalid JSON.
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.
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.
06:22 We just want a title. So we have to create this JSON here with this title task. Cool. Let's save it.
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.
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.
06:53 So once we do this, we also need to get variable. Range equals this, just get the active range, variable row equals range.getRow.
07:19 Variable column equals range.getColumn. Okay, now spreadsheet app dot get. ActiveSheet.getRange. We're going to use the same row.
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.
07:46 So this is just simply saying go to the active sheet, whatever range we're in, add one to the column, and set the value to yes.
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 now because we might have added the spreadsheet to it.
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.
08:25 But this is just for adding from Google Sheets into tasks. Maybe this is a list of tasks you need to add.
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.
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.
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.
09:02 From Sheets, maybe you have some more information here. We can add much more information, as you saw. We can add notes, notes, and write notes here, and we can have notes, and notes, and we can get that from, let's say, we have notes here.
09:25 Let's do all of this up here. And we're going to get variable notes equals spreadsheet app, get active sheet, get range, 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 plus two.
09:56 So we have notes here, follow up, send email, clean up inbox, yes. Let's do this. Add yes needed for knowing if we added it or not.
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.
10:26 So we actually need one more thing. Notes. Notes, ah, get value we need to add to there. Make sure it saves.
10:42 Okay, follow up. Now it will work. Add task. And we have follow up. Oh, we need to make sure column, what?
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.
11:15 That'll work now. Now, yes, do this is the notes here and the notes 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.
11:28 Hopefully this was helpful to you to add tasks to Google tasks. from Google Sheets. Bye.
Courses
Add Icons To Your Sheets With a Domain Name
00:04:21
Add Tasks to Google Tasks From Google Sheets
Convert Google Sheets into a REST API
Build a Book Recommender with AI in Google Sheets
Build a License Key Generator and API in 20 Minutes
Create Your Own API by Deploying a Web App
Access Free API's with Google Sheets
Use Random Quote API in Google Sheets
OpenSea Data Inside Sheets
Tag Emails From A List of Members in Google Sheets
Spreadsheet Automation 101 Lesson 4: Access APIs Introduction
How to Validate Email Addresses
Build Your Own Free Domain Availability Checker
Build a Job Status Checker API in 15 Minutes
Spreadsheet Automation 101 Lesson 4: UrlFetchApp
Spreadsheet Automation 101 Lesson 4: OmdbAPI get ApiKey, get Data in URL
Spreadsheet Automation 101 Lesson 4: OmdbAPI Parameter Picker
Spreadsheet Automation 101 Lesson 4: OmdbAPI get data in Apps Script
Spreadsheet Automation 101 Lesson 4: JSON (beautifier) and OmdbAPI parameters
Quickstart Tutorial OpenAI API in Google Sheets
Shaman: AI Blog Writer
ChatGPT Clone in Google Sheets Part 1
ChatGPT Clone in Google Sheets Part 2
How To Set Up Stripe Webhook to Google Sheets with Google Script
00:22:10
Create Instant QR Codes
Access the Dictionary API to get Definitions for Words in Google Sheets
Find "Entry Number" for Bookmarklet
00:07:26
Create a Vote Button from Google Sites to Google Sheets
Let's Make a Bookmarklet!
00:12:37
Redirect a Domain to a Google Sheet
00:01:57
How to Download a Sheet as a CSV with a URL only
00:04:22
Add Tasks to Google Tasks From Google Sheets
Add NPS to Your Google Site
Create an Internal Google Sheets Add-on
How To Export Your Beautiful Sheets to PDF
00:04:06