Utilities Service

This service provides utilities for string encoding/decoding, date formatting, JSON manipulation, and other miscellaneous tasks.

Classes

NameBrief description
CharsetA typesafe enum for character sets.
DigestAlgorithmSelector of Digest algorithm
MacAlgorithmSelector of MAC algorithm
UtilitiesThis service provides utilities for string encoding/decoding, date formatting, JSON manipulation, and other miscellaneous tasks.

Class Charset

Properties

PropertyTypeDescription
US_ASCIIEnum
UTF_8Enum

Class DigestAlgorithm

Properties

PropertyTypeDescription
MD2Enum
MD5Enum
SHA_1Enum
SHA_256Enum
SHA_384Enum
SHA_512Enum

Class MacAlgorithm

Properties

PropertyTypeDescription
HMAC_MD5Enum
HMAC_SHA_1Enum
HMAC_SHA_256Enum
HMAC_SHA_384Enum
HMAC_SHA_512Enum

Class Utilities

Properties

PropertyTypeDescription
CharsetCharset
DigestAlgorithmDigestAlgorithm
MacAlgorithmMacAlgorithm

Methods

MethodReturn typeBrief description
base64Decode(encoded)Byte[]Decodes a base 64 encoded string as a byte array.
base64Decode(encoded, charset)Byte[]Decodes a base 64 encoded string as a byte array.
base64Encode(data)StringGiven an array of bytes, returns the data as a base 64 encoded string.
base64Encode(data)StringGiven string, returns the data as a base 64 encoded string.
base64Encode(data, charset)StringGiven a string with a specific Charset, returns the data as a base 64 encoded string.
computeDigest(algorithm, value)Byte[]Compute a digest using the specified algorithm on the specified value
computeDigest(algorithm, value, charset)Byte[]Compute a digest using the specified algorithm on the specified value
computeHmacSha256Signature(value, key)Byte[]Signs the provided value using HMAC-SHA256 with the given key.
computeHmacSha256Signature(value, key, charset)Byte[]Signs the provided value using HMAC-SHA256 with the given key and character set.
computeHmacSignature(algorithm, value, key)Byte[]Compute a message authentication code using the specified algorithm on the specified key and value.
computeHmacSignature(algorithm, value, key, charset)Byte[]Compute a message authentication code using the specified algorithm on the specified key and value.
formatDate(date, timeZone, format)StringFormats date according to specification described in Java SE SimpleDateFormat class.
formatString(template, args)StringPerforms sprintf-like string formatting using '%'-style format strings.
newBlob(data)BlobCreate a new Blob object that is used in many Apps Script APIs that take binary data as input.
newBlob(data, contentType)BlobCreate a new Blob object that is used in many Apps Script APIs that take binary data as input.
newBlob(data, contentType, name)BlobCreate a new Blob object that is used in many Apps Script APIs that take binary data as input.
newBlob(data)BlobCreate a new Blob object that is used in many Apps Script APIs that take binary data as input.
newBlob(data, contentType)BlobCreate a new Blob object that is used in many Apps Script APIs that take binary data as input.
newBlob(data, contentType, name)BlobCreate a new Blob object that is used in many Apps Script APIs that take binary data as input.
parseCsv(csv)String[][]Returns a tabular 2D array representation of a CSV string.
parseCsv(csv, delimiter)String[][]Returns a tabular 2D array representation of a CSV string using a custom delimiter.
sleep(milliseconds)voidSleeps for specified number of milliseconds.
unzip(blob)Blob[]Takes a Blob representing a zip file and returns its component files.
zip(blobs)BlobCreates a new Blob object that is a zip file containing the data from the Blobs passed in.
zip(blobs, name)BlobCreates a new Blob object that is a zip file containing the data from the Blobs passed in.

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.