Google Sheets doesn’t have a built-in SHA-256 function. If you’ve ever tried to generate SHA-256 hashes directly inside a spreadsheet, you know it’s surprisingly not a default feature.

Instead of exporting your data to another tool, you can actually create your own custom formula with a few lines of Google Apps Script — and use it just like any built-in Sheets function.


🔧 How it works

Once you add the script to your spreadsheet, the custom =SHA256() formula becomes available just like any built-in function.

=SHA256(A1)

That’s it. Point it at any cell and it returns the SHA-256 hash of its value.

I wrote a quick walkthrough on how to set it up. The full guide, code and README are available in the public GitHub repository linked below.


Summary

I originally built this for a marketing data use case: hashing email addresses and other PII before passing them to external tools. In a world where LLMs and AI pipelines process more and more personal data, hashing at the spreadsheet level is a simple but meaningful step to protect sensitive information before it leaves your control.

If you work with audience data, contact lists or any PII in Google Sheets — this is a small addition that can make a real difference.

📎 Resources