I understand that we can write and read tasks using Google Apps Script. I was wondering if I could have the side bar open, as I click on a certain cell, containing a data. Then, the side bar would appear, showing the tasks due on that date.
Asked
Active
Viewed 239 times
-1
1 Answers
0
Unfortunately there is no way to open the Task sidebar from the UI class. As @Tanaike references, there is also no way to activate the UI from a Simple Trigger.
They cannot access services that require authorization.
onSelectionChange(e)
Simple Trigger pointing to "https://www.googleapis.com/auth/script.container.ui"
scope in this case
You could make a Feature Request, asking for that functionality to be integrated in Apps Script.
As a workaround you can activate a sidebar by creating an Installable Trigger, and using Task API to filling it, but in that case you would only have the edit
and change
events available. The trigger would only change when a value or the spreadsheet structure changed.
Code.gs
const test = (e) => {
// Getting all the task from a certain TaskList
// this should be tweaked for obtain the TaskList from a
// certain day
var tasks = Tasks.Tasks.list(TASKLIST_ID)
if (!tasks.items) return
Logger.log(tasks)
let htmlContent = tasks
.items
.map(task => `<li>${task.title}-${task.note}</li>`).join(' ')
SpreadsheetApp.getUi()
.showSidebar(HtmlService
.createHtmlOutput(htmlContent)
.setTitle('Custom Notes'))
}
Documentation

Emel
- 2,283
- 1
- 7
- 18
-
1You can open a sidebar from a menu. Then sidebar =[poll](https://stackoverflow.com/questions/30628894/how-do-i-make-a-sidebar-display-values-from-cells/30634581#30634581)> server(properties)<=`onSelectionChange()` – TheMaster Nov 25 '21 at 20:49
Hello World
').setTitle('Blank Sidebar')); }` – Cooper Nov 24 '21 at 23:16