gpt4 book ai didi

google-apps-script - 自定义函数获取此值后将值存储在单元格中/谷歌电子表格

转载 作者:行者123 更新时间:2023-12-04 07:22:08 24 4
gpt4 key购买 nike

我使用自定义函数:

 if (!address) {
throw new Error("No address specified!");
}
if (address.map) {
return address.map(LATLONG);
}
const key = ["address", address].join(",");
const value = getCache(key);
if (value !== null) return value;

const { results: [data = null] = [] } = Maps.newGeocoder().geocode(address);
if (data === null) {
throw new Error("Address not found!");
}
const { formatted_address } = data;
setCache(key, formatted_address);
return formatted_address;
};
应用功能后 =GOOGLEMAPS_ADDRESS(B59)在有 2000 多行的整列中,gs 服务器关闭,出现错误异常:一天内调用了太多次服务:地理编码。 (第 71 行)。这不是因为地址不对,而是因为每次移动行,删除或添加后都会发生请求。在此图片上显示一些单元格获得值,但主要是错误。 /image/YSoRQ.png
如何将获得的值存储在事件单元格中并在值将存储在那里后从事件单元格中删除自定义函数?

最佳答案

使用 trigger而不是公式:

function onEdit(e) {
e.range.offset(0,1).setValue(GOOGLEMAPS_ADDRESS(e.value));
}

关于google-apps-script - 自定义函数获取此值后将值存储在单元格中/谷歌电子表格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68428414/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com