Korzystanie @gabhubert odpowiedź, można to zrobić, jeśli chcesz uzyskać wyniki z całego rzędu. Z edytora skryptów.
function GetMD5Hash(value) {
var rawHash = Utilities.computeDigest(Utilities.DigestAlgorithm.MD5, value);
var txtHash = '';
for (j = 0; j <rawHash.length; j++) {
var hashVal = rawHash[j];
if (hashVal < 0)
hashVal += 256;
if (hashVal.toString(16).length == 1)
txtHash += "0";
txtHash += hashVal.toString(16);
}
return txtHash;
}
function straightToText() {
var ss = SpreadsheetApp.getActiveSpreadsheet().getSheets();
var r = 1;
var n_rows = 9999;
var n_cols = 1;
var column = 1;
var sheet = ss[0].getRange(r, column, n_rows, ncols).getValues(); // get first sheet, a1:a9999
var results = [];
for (var i = 0; i < sheet.length; i++) {
var hashmd5= GetMD5Hash(sheet[i][0]);
results.push(hashmd5);
}
var dest_col = 3;
for (var j = 0; j < results.length; j++) {
var row = j+1;
ss[0].getRange(row, dest_col).setValue(results[j]); // write output to c1:c9999 as text
}
}
A potem, z menu Run, wystarczy uruchomić straightToText function(), dzięki czemu można uzyskać wynik i wymykają się zbyt wiele połączeń do błędu funkcji.
Nicea odpowiedź. Możesz dodać 'Utilities.sleep (100)' gdzieś wewnątrz funkcji, aby zapobiec awariom podczas używania funkcji autouzupełniania (w przeciwnym razie przekroczony zostanie limit częstotliwości wywoływania funkcji) – leo
Nie mogę wydaje się, że to pasuje do tego, co robi 'md5sum (1)'; na przykład 'frew' w cli daje' c241183cbf6766bd86061a60d6c8fe1b' bez nowej linii, ale 'cfb5d06a43aad502d0f6219143ba0e34' z funkcji. –