













Add Checkbox in Google Sheets
Checkbox google sheets is a valuable tool for organizing, formatting, and validating data in Google Sheets. When you add checkbox in google sheets it will help make your data more visually attractive and easier to understand, and they can also be used to improve working with a team on 1 project.
Benefits of Adding Checkbox in Google Sheets
- Visual representation: Checkboxes can make data easier to read and understand, as they provide a clear visual representation of whether an item has been checked or not.
- Data organization: Checkboxes can help you organize your data by allowing you to mark items that have been completed or are still pending.
- Conditional formatting: You can use checkboxes to trigger conditional formatting in Google Sheets, which allows you to highlight or change the appearance of cells based on certain criteria.
- Data validation: Checkboxes can help ensure that data is entered correctly, as they only allow users to select from a predefined list of options.
- Improved collaboration: Checkboxes can be useful for collaborative projects, as they allow multiple people to work on the same document and track progress.
Syntax of IF statement
To get the most out of the google sheets checkbox we have to use and combine it with other functions such as IF statement which is very similar to SUMIF which you can read more about it in this post, the syntax of the IF statement is:
IF(logical_expression, value_if_true, value_if_false)
In our example above we used it to verify the cell C3 if it is true to return Done else Pending, sure you can replace the 2 words (Done and Pending) with any words you choose.
For Advanced Users
What if you want to send an email to your boss as soon as you check the tick box informing him that the task is done, the code below will answer this question, open the Extensions menu, choose the App Script submenu copy and paste the code and do not forget to replace the black marked in the code with your boss email.
function sendEmailOnCheckboxCheck() {
// Get the active sheet
var sheet = SpreadsheetApp.getActiveSheet();
// Get the range of the cells that contain checkboxes
var range = sheet.getRange("C3:C6");
// Get the values of the cells in the range
var values = range.getValues();
// Loop through the values and check if any of the cells contain a checked checkbox
for (var i = 0; i < values.length; i++) {
if (values[i][0] == true) {
// If a checked checkbox is found, send an email
sendEmail();
break;
}
}
}
function sendEmailOnCheckboxCheck(e) {
// Check if the edited cell contains a checkbox
if (e.value == "TRUE") {
// Set the email address and subject for the email
var emailAddress = "TYPE HERE YOUR BOSS EMAIL";
var subject = "REPLACE WITH YOUR SUBJECT";
// Set the body of the email
var body = "Done";
// Send the email
GmailApp.sendEmail(emailAddress, subject, body);
}
}
To set this up in Google App Script, you’ll need to create a new project, copy and paste the code into the script editor, and then create a trigger that runs the sendEmailOnCheckboxCheck function whenever a cell is edited. You can do this by going to the “Edit” menu and selecting “Current project’s triggers”.
Conclusion
Add checkbox in google sheets is a useful feature that can help you organize, manage and manipulate your data in a much more efficient way.
Thank you 🙂 very helpful
Thank you