Updated: GAS Library - BatchRequest

BatchRequest was updated to v1.2.1.

  • v1.2.1 (March 8, 2023)

    1. An option of exportDataAsBlob was added to the request object to the method of EDo(). Ref When this option is used, the response values from the batch requests are returned as Blob. By this, for example, when you export Google Spreadsheet as PDF data using the batch requests, the PDF data can be retrieved as Blob.

Sample script using exportDataAsBlob

In this sample, the Spreadsheet and Document files are exported as PDF format using the batch requests. The exported PDF data is created as a PDF file to the root folder. When I answered this thread on Stackoverflow, when this option is added to this library, I thought that it might be useful for users.

const fileIds = ["###SpreadsheetID1###", "###DocumentID1###"];
const requests = fileIds.map((id) => ({
  method: "GET",
  endpoint: `https://www.googleapis.com/drive/v3/files/${id}/export?mimeType=application/pdf`,
const reqs = {
  batchPath: "batch/drive/v3",
  exportDataAsBlob: true,
const blobs = BatchRequestTest.EDo(reqs); // Using this library
blobs.forEach((b) => {
  if (b) {
    console.log({ filename: b.getName(), fileSize: b.getBytes().length });

You can check this at https://github.com/tanaikech/BatchRequest.