Google电子表格颜色表标签

时间:2014-07-13 16:44:37

标签: google-sheets

我在电子表格中使用谷歌脚本,我想为工作表标签着色。你知道怎么做吗?

感谢您的回答

2 个答案:

答案 0 :(得分:0)

您需要使用setbackground的功能

我给你举了一个例子:

Function colorRow(r){
  var sheet = SpreadsheetApp.getActiveSheet();
  var c = sheet.getLastColumn();
  var dataRange = sheet.getRange(r, 1, 1, c);

    dataRange.setBackground("white");

}

Doc:https://developers.google.com/apps-script/reference/spreadsheet/range#setBackground(String)

答案 1 :(得分:0)

您可以使用setTabColor()。

您可以在Google文档中使用它:

// This example assumes there is a sheet named "first"
var ss = SpreadsheetApp.getActiveSpreadsheet();
var first = ss.getSheetByName("first");
first.setTabColor("ff0000"); // Set the color to red.
first.setTabColor(null); // Unset the color.
相关问题