我有一个Google电子表格,其中包含一个脚本,用于检查本地图书馆目录,以查看ISBN搜索过的图书是否已显示。没有API或RSS功能,因此我正在使用UrlFetchApp来屏幕显示HTML源中针对给定图书状态显示的某些唯一短语。
现在,当我打开电子表格时,我的电子表格只会更新“状态”列(根据ISBN字段调用脚本)。有没有办法让Google Script运行我的主要功能然后触发更改?我读过的文档只提到了用户编辑,这不是我想要的。
function ISBNsearch(ISBN){
var consortURL = "http://LIBRARYURL/search~S6/?searchtype=i&searcharg=" + ISBN + "&searchscope=4";
var retrieveURL = UrlFetchApp.fetch(consortURL).getContentText();
var searchURLno = retrieveURL.search("BROWSE SCREEN TABLE");
var searchURLyes = retrieveURL.search("Item Location");
var searchURLordered = retrieveURL.search("copy ordered for");
if (searchURLno > -1){
var answer = "Not found"
} else if (searchURLyes > "-1") {
answer = "in Consort"
} else if (searchURLordered > "-1") {
answer = "on order"
} else if ((searchURLno == "-1") && (searchURLyes == "-1") && (searchURLordered == "-1")) {
answer = "no input"; }
return answer;
}
function testScript(){
var response = ISBNsearch("9782711802036");
Logger.log("The answer is " + response);
return response;
}