1

I have a Google Sheet full of important links to images on Google Drive.
Is there a way to get MD5 Checksum from the files with a custom formula?

Here is my scenario:

No. | PHOTO            | MD5 CHECKSUM FROM PHOTO FROM G-DRIVE |

01  - LINK TO PHOTO 1  - MD5 CHECKSUM 1   
02  - LINK TO PHOTO 2  - MD5 CHECKSUM 2   
03  - LINK TO PHOTO 3  - MD5 CHECKSUM 3   
04  - LINK TO PHOTO 4  - MD5 CHECKSUM 4  

Writing let's say =CHECKSUM(C1)

0

Your script requires authorization in order to access Google Drive files. Custom Functions can't run services that require authorization but you could run your script from a

  • Google Apps Script editor
  • Installable trigger
  • Custom menu
  • Dialog
  • Sidebar
  • Web app

Regarding doing checksum on Google Drive files see Google Drive MD5 checksum for files

  • Yes, I need a script – GCC May 25 '18 at 17:56
-1

Open Tools > Script Editor then paste the following code:

function MD5 (input) {
  var rawHash = Utilities.computeDigest(Utilities.DigestAlgorithm.MD5, input);
  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;
}

Save it and then use the MD5() function in your spreadsheet while referencing a cell like:

=MD5(C1)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.