如何在 Google 应用脚本中创建动态下拉列表 [英] how to create dynamic dropdown list in the Google apps script
本文介绍了如何在 Google 应用脚本中创建动态下拉列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用 Google Apps 脚本动态更改 Google 电子表格单元格验证功能中候选列表的值.
I would like to dynamically change the value of the candidate list in the cell validation feature of a Google Spreadsheet using the Google Apps Script.
我无法使用 Google 公式功能在 Google 电子表格中创建动态下拉列表.
I failed to create dynamic dropdown list in a Google Spreadsheet using the Google Formulas Feature.
推荐答案
您现在可以使用 newDataValidation() 构建数据验证规则.
You can now use newDataValidation() to build a data validation rule.
示例:
// Set the data-validation rule for cell A1 to require a value from B1:B10.
var cell = SpreadsheetApp.getActive().getRange('A1');
var range = SpreadsheetApp.getActive().getRange('B1:B10');
var rule = SpreadsheetApp.newDataValidation().requireValueInRange(range)
.build();
cell.setDataValidation(rule);
来源:https://gsuite-developers.googleblog.com/2013/08/answering-another-top-request-data.html
这篇关于如何在 Google 应用脚本中创建动态下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文