Dashboard Mode - Why Apps Script automates Google Sheets
Dashboard Goal
Understand how Apps Script automates tasks in Google Sheets to save time and reduce errors.
Understand how Apps Script automates tasks in Google Sheets to save time and reduce errors.
| Task | Status | Due Date | Assigned To | Completed |
|---|---|---|---|---|
| Send weekly report | Pending | 2024-06-10 | Alice | FALSE |
| Update inventory | Completed | 2024-06-08 | Bob | TRUE |
| Review budget | Pending | 2024-06-12 | Charlie | FALSE |
| Clean data | Completed | 2024-06-09 | Alice | TRUE |
| Prepare presentation | Pending | 2024-06-15 | Bob | FALSE |
=COUNTA(A2:A6)=COUNTIF(E2:E6, TRUE)=COUNTIF(E2:E6, FALSE)function autoCompleteTasks() {
const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
const data = sheet.getRange('A2:E6').getValues();
const today = new Date();
for (let i = 0; i < data.length; i++) {
const dueDate = new Date(data[i][2]);
if (dueDate < today) {
sheet.getRange(i + 2, 5).setValue(true);
sheet.getRange(i + 2, 2).setValue('Completed');
}
}
}=QUERY(A1:E6, "select D, count(E) where E = TRUE group by D", 1)+----------------------+----------------------+----------------------+
| Total Tasks (5) | Completed Tasks (2) | Pending Tasks (3) |
+----------------------+----------------------+----------------------+
| Automated Status Update Table (Tasks with updated status) |
+-------------------------------------------------------------------+
| Summary Table (Completed tasks by person) |
+-------------------------------------------------------------------+
Adding a date filter lets you see tasks due before or after a certain date. When you change the filter, the Automated Status Update Table and KPI cards update automatically to reflect the filtered tasks. The summary table also updates to show completed tasks only for the filtered data.
If you add a filter to show only tasks assigned to "Alice", which components update and what changes?