【发布时间】:2019-02-27 14:58:21
【问题描述】:
我有一个 Google 电子表格,里面有几十张关于格式的相同表格。我必须对所有工作表应用相同的条件格式,所以我想在第一张工作表上手动制作,然后使用 Google Apps 脚本将条件格式应用到所有其他工作表。我已经完成了下面的编码,但我收到一个错误,从法语翻译过来,“条件格式规则不能引用另一个表”。
function myFunction() {
var my_spreadsheet = SpreadsheetApp.getActiveSpreadSheet();
var all_sheets = my_spreadsheet.getAllSheets();
var source_sheet = all_sheets[0];
var source_rules = source_sheet.getConditionalFormatRules();
var destination_sheet;
for (var i=1; i<=all_sheets.length-1; i++){
destination_sheet = all_sheets[i];
destination_sheet.setConditionalFormatRules(source_rules);
}
}
您知道如何使用 Google Apps 脚本或任何其他方式将条件格式从一张表复制到另一张表吗?
【问题讨论】:
标签: google-apps-script google-sheets conditional-formatting