I have a table within a Google Document (NOT sheets). I have created a custom menu and it will have a list of options. The goal is when the user selects one of the options, it will change the background color of the active cell (determined by where the cursor is). I attempted the below code and it ran with no errors, but it does not change the background color. Any ideas? Thanks!
function onOpen() {
var ui = DocumentApp.getUi();
ui.createMenu('Change Colors')
.addItem('Low', 'LowFunction')
.addToUi();
}
function LowFunction() {
DocumentApp.getUi()
var document = DocumentApp.getActiveDocument();
var SelectedCell = document.getCursor().getElement();
var range = SelectedCell.setBackgroundColor('#ffffff');
}
For some additional information, if I add the following line of code:
var SelectedCell = document.getTables()[1].getCell(1,0).setBackgroundColor('#000000');
It will change the background color of a particular cell...but I just need this code to change the color of the currently selected cell if possible.