1 | initial version |
You can modify the background color of an HTML table cell generated using Google Apps Script in Google Sheets by setting the "background-color" attribute in the cell's style property. Here's an example:
function setCellBackgroundColor() {
var sheet = SpreadsheetApp.getActiveSheet();
var cell = sheet.getRange("A1");
// Set the cell's background color to red
var backgroundColor = "red";
var style = "background-color:" + backgroundColor;
cell.setNotes("<td style='" + style + "'>Hello World</td>");
}
In this example, we're setting the background color of cell A1 to red using the "style" property. The "style" property allows you to set inline CSS styles for HTML elements, including table cells.