- Understand what metadata Drive manages (name, tags, indexableText, and thumbnails) and what metadata belongs to other Google Cloud services.
- Use the Drive API to query and adjust metadata; clean EXIF and embedded data before uploading files.
- Respect limits and rules (thumbnails, indexable text, extensions) and authenticate with gcloud for local REST testing.
Do you want to control the metadata of your files in Google Drive and don't know where to start? Here we explain, in detail, How to remove metadata in Google Drive effectively and safely (the metadata of uploaded files). We also tell you what limits Google imposes on file names, sizes, and permissions.
This guide will give you a complete and realistic understanding of what can (and can't) be "deleted" when it comes to metadata in Google Drive.
What can be changed or “deleted” in Drive
These are the Metadata that can be removed from files uploaded to Google Drive:
Name and extension: When creating a file via the API, it's a good idea to specify the extension in the name field, for example, "cat.jpg." Drive can infer the extension from the MIME type if you don't specify it, but it's better to define it yourself. In subsequent responses, a read-only fileExtension may appear with the extension populated from name. If a user downloads the file, Drive compiles the final name from the title (and its extension).
- Indexable text (contentHints.indexableText): Drive indexes common documents and types (PDFs, OCR-enabled images, etc.) by default. If your app saves other formats (drawings, videos, shortcuts), you can provide indexable text to improve search. This text is processed as HTML: if you pass a string containing tags, the textual content is indexed, not the tag attributes. There is a 128KB size limit for contentHints.indexableText, and it's recommended that you update it on each save and keep it relevant to the file.
- Thumbnails (contentHints.thumbnail): Drive generates thumbnails for many types, but for formats that don't automatically generate them, you can upload your own when you create or update the file. You must set the image to URL-safe base64 and the corresponding mimeType. Key rules: Supported formats are PNG, GIF, or JPG; recommended width is 1600px (minimum 220px), and maximum size is 2MB. Thumbnails are invalidated when the file content changes; metadata changes do not.
- Access to thumbnails: The ThumbnailLink field returns a short URL, accessible only if the app has permission to read the file (if it's not public, you'll need to request it with credentials). You can query it for a specific file or for a list filtered by type.
- Labels: Drive allows you to associate labels with files. To locate them, you can use files.listLabels, and to modify them, you must reference the corresponding labelId and fileId. This mechanism is useful for categorizing and, if necessary, "cleaning" unwanted classifications without touching the content.
Delete metadata in Google Drive: “hidden” metadata from the file itself
There's no magic button to remove metadata in Google Drive (such as EXIF in photos or embedded data in PDFs). Drive manages its own metadata, but the metadata within the file depends on the tool that created it.
The recommended practice is clean the file before uploading it to Drive, Using system tools or specialized apps that remove EXIF data from images or document properties. This way, the content you save in Drive arrives "sanitized."
If you already have files uploaded with embedded metadata, instead of removing metadata in Google Drive, it is more convenient download, clean and re-upload, replacing the original if applicable. With PDFs or images, this is common when you want to protect authorship, location, or editing history.
For the specific part of Drive, focus on adjusting name, labels and contentHints (indexableText/thumbnail), that are under your control. If you also manage access permissions, you also reduce the exposure of visible metadata (for example, thumbnail links accessible to those with reading rights).
Do not forget that Changing only Drive metadata does not remove EXIF or internal properties. Therefore, your strategy should combine pre-cleaning the file with the fine-grained metadata management that Drive allows you to touch.
Commonly confused metadata in Google Cloud: VMs, gcloud, and limits
If you work with Google Cloud, you will see many guides about “metadata” that actually refer to Compute Engine or Cloud Storage, not Drive. Even so, you'll want to know these points so you don't get them mixed up when researching.
Basic gcloud CLI configuration
After installing Google Cloud CLI, initialize with:
gcloud init
It is important to make sure you have the latest version with:
gcloud components update
If you use an external identity provider, Sign in with your federated identity before working with gcloud, especially if you're going to authenticate to make REST calls from your local environment. REST API samples can use the credentials you've configured in gcloud.
VMs
Permissions and roles (Compute Engine): To add, update, or delete custom metadata on VMs, you need appropriate IAM permissions. Common examples include:
- If your VMs use service accounts: permission
iam.serviceAccounts.actAsin the service or project account. - Project metadata:
compute.projects.getycompute.projects.setCommonInstanceMetadata. - Zonal metadata:
compute.instanceSettings.getycompute.instanceSettings.updatefor the relevant area. - Instance metadata:
compute.instances.getycompute.instances.setMetadata.
Limitations
These are the main limitations we encountered when trying to remove metadata in Google Drive:
- Size Limitations (Compute Engine): The combined total of metadata entries is capped at 512 KB. Each key is limited to 128 bytes, and each value is limited to 256 KB. If, for example, you use the ssh-keys key and exceed the 256 KB limit, you won't be able to add more keys until you clean up.
- Upper case and lower case: Keys are case-sensitive; values are too, except for Booleans. In zonal, you can't create two keys that differ only in case (zonal-metadata-key vs. ZONAL-METADATA-KEY).
- Zonal metadata: are set or removed using gcloud or REST. You can't define zonal values for SSH keys (ssh-keys). In the logical project/ directory, if there are project-level and zonal values for the same key, the zonal value takes precedence in its zone.
- Supported boolean values: In addition to TRUE/FALSE, you can use Y/Yes/1 and N/No/0 (case insensitive).
- Configuration Scopes (Compute Engine):
- Project: metadata common to all VMs in the project.
- Zonal: entries that affect all VMs in a particular zone and can override the project value.
- Instance: metadata for a specific VM (being created or already existing).

Thumbnails, indexing, and metadata retrieval in Drive (REST and best practices)
Let's now look at the role of thumbnails when removing metadata in Google Drive. And also the best way to recover them:
- Authentication for REST on-premises: If you're testing REST examples from your machine, use the credentials configured with gcloud. This way, your Drive API calls will respect the identity and permissions you've already set.
- Custom thumbnail upload: set contentHints.thumbnail with two fields: the URL-safe base64 image and the correct mimeType. If Drive can automatically generate a thumbnail, it will use its own and skip yours. Otherwise, it will use the one you provide.
Key rules for thumbnails in Drive:
- Formats: PNG, GIF or JPG.
- Recommended width: 1600 px (minimum 220 px).
- Maximum size: 2MB.
- Update the thumbnail with each save if it is still relevant.
Important about invalidation: Thumbnails are invalidated when the file's contents are changed; metadata changes don't. If you only change tags or the name, don't expect a new thumbnail unless you modify the file.
Indexable text
Don't try to "fool" the search with buzzwords. Capture concepts and terms that a user would reasonably search for that file, and check the 128KB limit. Update it whenever the content changes substantially.
Apply consistent names and extensionsWhenever possible, include the extension in the name when uploading; if it's missing, Drive will try to infer it by MIME. Keeping names clear will avoid ambiguities and allow for easier extension searches.
Tags in Drive
To modify labels, note the necessary identifiers. You'll need the label's labelId and the file's fileId. You can first list them with files.listLabels and then apply the corresponding changes to the target file.
// Al modificar etiquetas de un archivo en Drive:
// - labelId: identificador de la etiqueta a cambiar
// - fileId: identificador del archivo al que aplicas la etiqueta
// Usa files.listLabels para localizarlas antes de actualizar.
Remember that, Although Drive is the focus, many developments combine Drive with Cloud Storage or other services, Hence you will see examples of Storage to inspect object attributes.
// Ejemplo en Go para obtener atributos de un objeto en Cloud Storage (no Drive)
// e imprimir metadatos como ContentType, CacheControl, MD5, etc.
// Útil si tu flujo sube primero a Storage y luego a Drive.
import (
"context"
"fmt"
"io"
"time"
"cloud.google.com/go/storage"
)
func getMetadata(w io.Writer, bucket, object string) (*storage.ObjectAttrs, error) {
ctx := context.Background()
client, err := storage.NewClient(ctx)
if err != nil { return nil, fmt.Errorf("storage.NewClient: %w", err) }
defer client.Close()
ctx, cancel := context.WithTimeout(ctx, 10*time.Second)
defer cancel()
o := client.Bucket(bucket).Object(object)
attrs, err := o.Attrs(ctx)
if err != nil { return nil, fmt.Errorf("Object(%q).Attrs: %w", object, err) }
fmt.Fprintf(w, "Bucket: %v\n", attrs.Bucket)
fmt.Fprintf(w, "CacheControl: %v\n", attrs.CacheControl)
fmt.Fprintf(w, "ContentDisposition: %v\n", attrs.ContentDisposition)
fmt.Fprintf(w, "ContentEncoding: %v\n", attrs.ContentEncoding)
fmt.Fprintf(w, "ContentLanguage: %v\n", attrs.ContentLanguage)
fmt.Fprintf(w, "ContentType: %v\n", attrs.ContentType)
fmt.Fprintf(w, "Crc32c: %v\n", attrs.CRC32C)
fmt.Fprintf(w, "Generation: %v\n", attrs.Generation)
fmt.Fprintf(w, "KmsKeyName: %v\n", attrs.KMSKeyName)
fmt.Fprintf(w, "Md5Hash: %v\n", attrs.MD5)
fmt.Fprintf(w, "MediaLink: %v\n", attrs.MediaLink)
fmt.Fprintf(w, "Metageneration: %v\n", attrs.Metageneration)
fmt.Fprintf(w, "Name: %v\n", attrs.Name)
fmt.Fprintf(w, "Size: %v\n", attrs.Size)
fmt.Fprintf(w, "StorageClass: %v\n", attrs.StorageClass)
fmt.Fprintf(w, "TimeCreated: %v\n", attrs.Created)
fmt.Fprintf(w, "Updated: %v\n", attrs.Updated)
fmt.Fprintf(w, "Event-based hold enabled? %t\n", attrs.EventBasedHold)
fmt.Fprintf(w, "Temporary hold enabled? %t\n", attrs.TemporaryHold)
fmt.Fprintf(w, "Retention expiration time %v\n", attrs.RetentionExpirationTime)
fmt.Fprintf(w, "Custom time %v\n", attrs.CustomTime)
fmt.Fprintf(w, "Retention: %+v\n", attrs.Retention)
fmt.Fprintf(w, "\n\nMetadata\n")
for key, value := range attrs.Metadata {
fmt.Fprintf(w, "\t%v = %v\n", key, value)
}
return attrs, nil
}
Deleting files vs. deleting metadata in Google Drive
If what you want is delete a file from DriveAs the owner, you can move it to the trash from the web by right-clicking and choosing Move to Trash. If the owner is someone else, you can only "Remove" the file from your view; others will still be able to see it.
To To permanently delete a file, you must empty the trash or use the permanent deletion option, In this case, you won't be able to recover it. This, by itself, doesn't "remove metadata" from other files—it applies only to that item.
You can't delete metadata in Google Drive from files you don't own, because their control belongs to the person who created them or to someone with higher permissions within the organization. In these cases, you simply remove your access or visibility.
Relating it to metadata: Deleting a file deletes its metadata in Drive along with it, but it does not affect metadata in other copies or embedded metadata in other documents that remain in the system.
With all the above, you can now differentiate well What metadata Drive controls (name, tags, search hints, and thumbnails), how to query them via REST, what best practices to follow for cleaning embedded data before uploading, and what limits and permissions come into play when you come across Google Cloud documentation that talks about “metadata” in other contexts.
Editor specialized in technology and internet issues with more than ten years of experience in different digital media. I have worked as an editor and content creator for e-commerce, communication, online marketing and advertising companies. I have also written on economics, finance and other sectors websites. My work is also my passion. Now, through my articles in Tecnobits, I try to explore all the news and new opportunities that the world of technology offers us every day to improve our lives.