Uppercase and Lowercase with Apps Script

To convert a string to uppercase or lowercase, use one of the following methods:

  • String.toUpperCase(): uppercase
  • String.toLowerCase(): lowercase

Usage Examples

Converting a string to uppercase:

const ref = 'eTv5-8zUi-oP0wq';

console.log(ref.toUpperCase()); // Returns: ETV5-8ZUI-OP0WQ

Converting a string to lowercase:

const email = 'Mon-Email@DOMAIN.test';

console.log(email.toLowerCase()); // Returns: mon-email@domain.test

First Character in Uppercase

First, copy the following function:

function ucfirst(str) {
  // Source: https://www.sheets-pratique.com/en/codes/uppercase-lowercase
  return str[0].toUpperCase() + str.slice(1);

Then use it like this:

const test = 'example';

console.log(ucfirst(test)); // Returns: Example