【发布时间】:2019-03-08 08:29:16
【问题描述】:
我实现了此处提到的 MD5 公式:Hash of a cell text in Google Spreadsheet。
function MD5 (input) {
var rawHash = Utilities.computeDigest(Utilities.DigestAlgorithm.MD5, input);
Utilities.sleep(100)
var txtHash = '';
for (i = 0; i < rawHash.length; i++) {
var hashVal = rawHash[i];
if (hashVal < 0) {
hashVal += 256;
}
if (hashVal.toString(16).length == 1) {
txtHash += '0';
}
txtHash += hashVal.toString(16);
}
return txtHash;
}
现在我想用ARRAYFORMULA 运行它,但我无法让它工作。我试过这个:
=ARRAYFORMULA(({"FiBu MD5";IF(ISBLANK(AG2:AG),"",(MD5(O2:O)))}))
我得到的错误是:
“无法将 Array 转换为 (class)[]。(第 2 行)。”
有人知道如何解决这个问题吗?
【问题讨论】:
标签: google-apps-script google-sheets md5 array-formulas custom-function