请,我需要从一个电子表格中带一个数据列表,把它放在下拉列表中,但是我无法让下面的代码工作。
代码:
function cityDataValidation() {
const ss = SpreadsheetApp.getActive();
const sh = ss.getSheetByName("Responses");
const rg = sh.getRange(2,7,sh.getMaxRows() - 1);
const vsh = ss.getSheetByName("City");
const vrg = vsh.getRange("A2:A100");
const rule = SpreadsheetApp.newDataValidation().requireValueInRange(vrg).build();
rg.setDataValidation(rule);
}
埃斯特斯爪哇。我需要的是将A,B,C,D,E项替换为电子表格中的列表,其中工作表名为" list“。
<script>
const apiCall = function (functionName, params = {}) {
params = JSON.stringify(params);
return new Promise((resolve, reject) => {
google.script.run
.withSuccessHandler((response) => resolve(JSON.parse(response)))
.withFailureHandler((error) => reject(error))
[functionName](params);
});
};
const getFormData = (form) => {
const data = {};
Object.entries(form).forEach(([key, item]) => {
data[key] = item.value;
});
return data
};
const form = {
city: {
label: "Lugar de trabajo",
type: "select",
value: "",
items: [("A", "B", "C", "D", "E")],
disabled: false,
placeholder: "",
rules: [(v) => !!v || "¡Esto es requerido!"],
},
}
</script>
Este el HTML
<v-col cols="12" sm="12" md="6" lg="2" xl="3">
<my-input :item="form.city"></my-input>
</v-col>
发布于 2022-10-20 19:11:59
这对我起了作用:
function cityDataValidation() {
const ss = SpreadsheetApp.getActive();
const sh = ss.getSheetByName("Sheet0");
const rg = sh.getRange(2,7,sh.getMaxRows() - 1);
const vsh = ss.getSheetByName("Sheet1");
const vrg = vsh.getRange("A2:A100");
const rule = SpreadsheetApp.newDataValidation().requireValueInRange(vrg).build();
rg.setDataValidation(rule);
}
https://stackoverflow.com/questions/74144018
复制相似问题