function downloadFile(fileId) {
  const exportUrl = `https://www.googleapis.com/drive/v3/files/${fileId}?alt=media&supportsAllDrives=true`;

  const requestOptions = {
    headers: {
      Authorization: `Bearer ${ScriptApp.getOAuthToken()}`,
    },
  };
  const response = UrlFetchApp.fetch(exportUrl, requestOptions);
  const blob = response.getBlob();

  return Utilities.base64Encode(blob.getBytes());
}
Downloads a binary file from Drive.

@param {string} fileId - ID of file to export
@param {string} targetType - MIME type to export as
@return Base64 encoded file content