Template: data validations
template_sheet_add_dval(wb, sheet, dval) takes the same object as the entries of ws["!validations"].
See Data validations for every key.
template_sheet_remove_dval_range(wb, sheet, range) removes every validation that overlaps the range.
The whole validation is removed, even if only a part of it overlaps.
const XLSX = require("@agent-sheet/wasm");const src = XLSX.utils.book_new();XLSX.utils.book_append_sheet(src, XLSX.utils.aoa_to_sheet([[1], [2], [3]]), "Sheet1");const wb = XLSX.read(XLSX.write(src, { type: "buffer", bookType: "xlsx" }), { template: true });XLSX.utils.template_sheet_add_dval(wb, "Sheet1", { ref: "A1:A3", t: "List", l: ["x", "y"] });let out = XLSX.read(XLSX.write(wb, { type: "buffer", bookType: "xlsx", template: true }));console.log(out.Sheets.Sheet1["!validations"].length);XLSX.utils.template_sheet_remove_dval_range(wb, "Sheet1", "A2");out = XLSX.read(XLSX.write(wb, { type: "buffer", bookType: "xlsx", template: true }));console.log(out.Sheets.Sheet1["!validations"]);1undefined