Allowing others to add Google tasks

1.2k Views Asked by At

I am looking for a way for employees to send me an email or add information to a spreadsheet that will then add tasks to my task list. Ideally, the script would capture the task list, task, due date, and any notes.

I have already successfully implemented five scripts (five task lists) that allow my employees to add tasks to specific tasklists, following this script shown below. This works OK but does not have the capacity to add due dates or notes:

Automated email to task list API

I recently came across references to scripts that monitors task lists, and then posts them to a spread sheet, including task, due dates, notes, etc. It strikes me that a spreadsheet might be a better way to do this though it does not have the convenience of email:

Task list to spreadsheet API

I wonder if the REVERSE can be done. I envision a spreadsheet that I could give my employees access to, with two worksheets (NEW and PROCESSED) with columns:

TASKLIST   TASK   DUE DATE   NOTES

and the script would run through this every hour or two. Anything in NEW would be processed and added to my task list, then moved to the end of PROCESSED.

Does anyone know of something like that out there? Alternatively, perhaps there are ways to change the email script so that it moves anything in the body of the email into the NOTES section of the task. I am a raw newbie at this BTW. Thanks.

3

There are 3 best solutions below

0
On

you should replace
var newTask = Tasks.newTask().setTitle(title);
by
var newTask = Tasks.newTask().setTitle(title).setDue(date).setNotes(notes);

I'm also stuck in the way

I can from a spreadsheet : - Create a new tasklist - Create a new task in a dedicated tasklist (with due date and notes)

I can from the Gtasks : - Check if the task is completed and mark it as completed in the spreadsheet - Check if the task still exists in the spreadsheet and remove it if necessary

I'm still looking for a way to make a task completed in GTasks when it's closed in spreadsheet

0
On

All the functionality exists for you to accomplish this, but I don't know if there is a pre-built script out there that does what you want. You may want to look into use a Google Form that saves data to the spreadsheet, and then create a trigger for form submit that scoops up the data and creates a new task using it.

0
On

Is this [part] of what you're looking for?

https://developers.google.com/apps-script/articles/google_apis_reading_list

It syncs a Spreadsheet based task list with a your regular Task List, and if you mark the task done in gmail, it records that back in the spreadsheet.

// Fetch the list of URLs to keep synchronized var articleUrls = SpreadsheetApp.getActiveSheet().getRange("A2:A"); for (var rowNum = 0; rowNum < articleUrls.getNumRows(); rowNum++) {

// Limit our range to a single cell containing a URL
var oneUrlCell = articleUrls.offset(rowNum, 0, 1, 1);  
if (oneUrlCell.getComment() === "") {
  // This is a new URL that needs to be shortened/inserted
  var urlText = oneUrlCell.getValue();
  if (urlText !== "") {
    // Shorten the URL
    Logger.log("Adding task for url: " + urlText);
    var toShorten = UrlShortener.newUrl().setLongUrl(urlText);
    var shortened = UrlShortener.Url.insert(toShorten);

    // Insert the shortened URL into our reading list
    var taskToInsert = Tasks.newTask().setTitle(shortened.getId());
    taskToInsert.setNotes(urlText);
    var newTask = Tasks.Tasks.insert(taskToInsert, readingListId);

    // Save the new ID as our comment.
    oneUrlCell.setComment(newTask.getId());
  }
} else {
  // This URL has already been inserted, update the status
  var existingTask = Tasks.Tasks.get(readingListId, oneUrlCell.getComment());
  if (existingTask.getStatus() === "completed") {
    var absRowNum = oneUrlCell.getRow();
    var completedCell = sheet.getRange(absRowNum, 2);
    completedCell.setValue("Yes");
  }
}

Should be part of the solution, no?

I'm looking to make something a bit bigger myself.