Gibt die Daten in diesem Objekt als Blob zurück, der in den angegebenen Inhaltstyp konvertiert wurde. Bei dieser Methode wird dem Dateinamen die entsprechende Erweiterung hinzugefügt, z. B. „meinedatei.pdf“. Es wird jedoch davon ausgegangen, dass der Teil des Dateinamens, der auf den letzten Punkt (falls vorhanden) folgt, eine vorhandene Erweiterung ist, die ersetzt werden soll. Daraus wird „Einkaufsliste.25.12.2014“ zu „Einkaufsliste.25.12.pdf“.
Die täglichen Kontingente für Conversions finden Sie unter Kontingente für Google-Dienste. Für neu erstellte Google Workspace-Domains gelten möglicherweise vorübergehend strengere Kontingente.
Parameter
Name
Typ
Beschreibung
contentType
String
Der MIME-Typ, in den konvertiert werden soll. Für die meisten Blobs ist 'application/pdf' die einzige gültige Option. Bei Bildern im BMP-, GIF-, JPEG- oder PNG-Format sind auch 'image/bmp', 'image/gif', 'image/jpeg' oder 'image/png' zulässig. Für ein Google Docs-Dokument ist auch 'text/markdown' zulässig.
Legt den Inhaltstyp der Bytes in diesem Blob basierend auf der Dateiendung fest. Der contentType-Wert ist null, wenn er nicht anhand der Erweiterung erraten werden kann.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Benötigte Informationen nicht gefunden","missingTheInformationINeed","thumb-down"],["Zu umständlich/zu viele Schritte","tooComplicatedTooManySteps","thumb-down"],["Nicht mehr aktuell","outOfDate","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Problem mit Beispielen/Code","samplesCodeIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-07-26 (UTC)."],[[["\u003cp\u003eA Blob is a data interchange object used for storing and manipulating binary data within Apps Script services.\u003c/p\u003e\n"],["\u003cp\u003eBlobs provide methods for setting, getting, and converting data in various formats, including bytes, strings, and specific content types.\u003c/p\u003e\n"],["\u003cp\u003eIt allows manipulation of data content, type, and name using dedicated methods.\u003c/p\u003e\n"],["\u003cp\u003eBlobs can handle Google Workspace files and offer functionalities for managing them within Apps Script.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003egetAllBlobs()\u003c/code\u003e method is deprecated and should not be used in new scripts.\u003c/p\u003e\n"]]],[],null,["Blob\n\nA data interchange object for Apps Script services. \n\nMethods\n\n| Method | Return type | Brief description |\n|-------------------------------------------------------------------------|-------------|---------------------------------------------------------------------------------------|\n| [copyBlob()](#copyBlob()) | [Blob](#) | Returns a copy of this blob. |\n| [getAs(contentType)](#getAs(String)) | [Blob](#) | Return the data inside this object as a blob converted to the specified content type. |\n| [getBytes()](#getBytes()) | `Byte[]` | Gets the data stored in this blob. |\n| [getContentType()](#getContentType()) | `String` | Gets the content type of the bytes in this blob. |\n| [getDataAsString()](#getDataAsString()) | `String` | Gets the data of this blob as a String with UTF-8 encoding. |\n| [getDataAsString(charset)](#getDataAsString(String)) | `String` | Gets the data of this blob as a string with the specified encoding. |\n| [getName()](#getName()) | `String` | Gets the name of this blob. |\n| [isGoogleType()](#isGoogleType()) | `Boolean` | Returns whether this blob is a Google Workspace file (Sheets, Docs, etc.). |\n| [setBytes(data)](#setBytes(Byte)) | [Blob](#) | Sets the data stored in this blob. |\n| [setContentType(contentType)](#setContentType(String)) | [Blob](#) | Sets the content type of the bytes in this blob. |\n| [setContentTypeFromExtension()](#setContentTypeFromExtension()) | [Blob](#) | Sets the content type of the bytes in this blob based on the file extension. |\n| [setDataFromString(string)](#setDataFromString(String)) | [Blob](#) | Sets the data of this blob from a string with UTF-8 encoding. |\n| [setDataFromString(string, charset)](#setDataFromString(String,String)) | [Blob](#) | Sets the data of this blob from a string with the specified encoding. |\n| [setName(name)](#setName(String)) | [Blob](#) | Sets the name of this blob. |\n\nDeprecated methods\n\n| Method | Return type | Brief description |\n|---------------------------------|-------------|------------------------------------------------------------------------------|\n| [getAllBlobs()](#getAllBlobs()) | [Blob[]](#) | Gets all the blobs that are contained within this (possibly composite) blob. |\n\nDetailed documentation \n\n`copy``Blob()` \nReturns a copy of this blob.\n\nReturn\n\n\n[Blob](#) --- The new copy.\n\n*** ** * ** ***\n\n`get``As(contentType)` \nReturn the data inside this object as a blob converted to the specified content type. This\nmethod adds the appropriate extension to the filename---for example, \"myfile.pdf\". However, it\nassumes that the part of the filename that follows the last period (if any) is an existing\nextension that should be replaced. Consequently, \"ShoppingList.12.25.2014\" becomes\n\"ShoppingList.12.25.pdf\".\n\nTo view the daily quotas for conversions, see [Quotas for Google\nServices](https://developers.google.com/apps-script/guides/services/quotas). Newly created Google Workspace domains might be temporarily subject to stricter\nquotas.\n\nParameters\n\n| Name | Type | Description |\n|-----------------|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `content``Type` | `String` | The MIME type to convert to. For most blobs, `'application/pdf'` is the only valid option. For images in BMP, GIF, JPEG, or PNG format, any of `'image/bmp'`, `'image/gif'`, `'image/jpeg'`, or `'image/png'` are also valid. For a Google Docs document, `'text/markdown'` is also valid. |\n\nReturn\n\n\n[Blob](#) --- The data as a blob.\n\n*** ** * ** ***\n\n`get``Bytes()` \nGets the data stored in this blob.\n\nReturn\n\n\n`Byte[]` --- The stored bytes.\n\n*** ** * ** ***\n\n`get``Content``Type()` \nGets the content type of the bytes in this blob.\n\nReturn\n\n\n`String` --- The content type of this data, if known, or `null`.\n\n*** ** * ** ***\n\n`get``Data``As``String()` \nGets the data of this blob as a String with UTF-8 encoding.\n\nReturn\n\n\n`String` --- The data as a string.\n\n*** ** * ** ***\n\n`get``Data``As``String(charset)` \nGets the data of this blob as a string with the specified encoding.\n\nParameters\n\n| Name | Type | Description |\n|-----------|----------|-------------------------------------------------------------------|\n| `charset` | `String` | The charset to use in encoding the data in this blob as a string. |\n\nReturn\n\n\n`String` --- The data as a string.\n\n*** ** * ** ***\n\n`get``Name()` \nGets the name of this blob.\n\nReturn\n\n\n`String` --- The name of this data, if known, or `null`.\n\n*** ** * ** ***\n\n`is``Google``Type()` \nReturns whether this blob is a Google Workspace file (Sheets, Docs, etc.).\n\nReturn\n\n\n`Boolean` --- `true` if this blob is a Google Workspace file; `false` if not.\n\n*** ** * ** ***\n\n`set``Bytes(data)` \nSets the data stored in this blob.\n\nParameters\n\n| Name | Type | Description |\n|--------|----------|---------------|\n| `data` | `Byte[]` | The new data. |\n\nReturn\n\n\n[Blob](#) --- This blob, for chaining.\n\n*** ** * ** ***\n\n`set``Content``Type(contentType)` \nSets the content type of the bytes in this blob.\n\nParameters\n\n| Name | Type | Description |\n|-----------------|----------|----------------------|\n| `content``Type` | `String` | The new contentType. |\n\nReturn\n\n\n[Blob](#) --- This blob, for chaining.\n\n*** ** * ** ***\n\n`set``Content``Type``From``Extension()` \nSets the content type of the bytes in this blob based on the file extension. The contentType is\n`null` if it cannot be guessed from its extension.\n\nReturn\n\n\n[Blob](#) --- This blob, for chaining.\n\n*** ** * ** ***\n\n`set``Data``From``String(string)` \nSets the data of this blob from a string with UTF-8 encoding.\n\nParameters\n\n| Name | Type | Description |\n|----------|----------|------------------|\n| `string` | `String` | The string data. |\n\nReturn\n\n\n[Blob](#) --- This blob, for chaining.\n\n*** ** * ** ***\n\n`set``Data``From``String(string, charset)` \nSets the data of this blob from a string with the specified encoding.\n\nParameters\n\n| Name | Type | Description |\n|-----------|----------|---------------------------------------------------------|\n| `string` | `String` | The string data. |\n| `charset` | `String` | The charset to use in interpreting the string as bytes. |\n\nReturn\n\n\n[Blob](#) --- This blob, for chaining.\n\n*** ** * ** ***\n\n`set``Name(name)` \nSets the name of this blob.\n\nParameters\n\n| Name | Type | Description |\n|--------|----------|---------------|\n| `name` | `String` | The new name. |\n\nReturn\n\n\n[Blob](#) --- This blob, for chaining.\n\nDeprecated methods \n\n`get``All``Blobs()` \n\n**Deprecated.** This function is deprecated and should not be used in new scripts.\n\nGets all the blobs that are contained within this (possibly composite) blob.\n\nReturn\n\n\n[Blob[]](#) --- The blobs contained within the blob."]]