Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9782

Need an app script for Google Sheets that changes the color of a checkbox cell to a specific color depending on the user who checked it

$
0
0

I have a daily task list with check boxes for each task that is accessed by multiple coworkers multiple times per day. I'm currently using the below script to change the color of the cells based onEdit for WHO edited the cell, however I want to change it to ONLY change to their color IF they check the box (TRUE) and for it to go back to no color if the box is unchecked (if I accidentally check a box, or check the wrong box). How can I change my script to do this?

function onEdit(e) {// Get the current user's email addressvar userEmail = Session.getActiveUser().getEmail();

// Set the background color of the edited cell based on the userif (userEmail === "user1@example.com") {e.range.setBackground("yellow");} else if (userEmail === "user2@example.com") {e.range.setBackground("green");} else {e.range.setBackground("red");}}


Viewing all articles
Browse latest Browse all 9782

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>