class Utilities method .base64Encode()

Utilities is the Apps Script service.

.base64Encode() is the method name you will see after a dot in your code.

What it does

Encodes a string or bytes as Base64.

Why it's used

  • Encode data for Basic auth headers or API payloads.
  • Prepare binary content for safe text transport.

Common errors

  • Forgetting parentheses on base64Encode. Write Utilities.base64Encode(), not Utilities.base64Encode or base64Encode by itself.
  • Skipping dots between chained calls. Each step needs a dot, like Utilities.base64Encode().
  • Adding spaces where they do not belong. Write Utilities.base64Encode(), not Utilities .base64Encode(), Utilities.base64Encode (), or Utilities . base64Encode().
  • Wrong capitalization. Use Utilities and base64Encode, not utilities or base64encode.

Explore

Related methods

Better Sheets tutorials

Password Protecting Data In a Google Sheet

Password Protecting Data In a Google Sheet

A funky way to password protect some data in a sheet, 3 ways to do it: w...
Password Protecting Data In a Google Sheet Part 2 The Basics

Password Protecting Data In a Google Sheet Part 2 The Basics

Covering some of the basics I skipped over in the part 1 video.
Tweet From a Sheet

Tweet From a Sheet

See how to tweet from a sheet and get the code below.

Related blog posts

Written guides about Utilities.base64Encode().

Browse the blog