Add Label to File
Definition
The "Add Label to File" action allows you to apply structured metadata (labels) to a specific Google Drive file using the file’s ID and either a selected or manually provided label ID. Labels help categorize, organize, and manage Drive files with custom fields such as text, selection, dates, or user info. This action supports adding multiple fields within a label, enabling you to enrich your files with contextually relevant data.
This is especially useful for workflows involving document classification, compliance tagging, content review tracking, and automations where Drive metadata plays a key role. With this action, you gain precise control over how labels are applied and what values are associated with them.
Example Use Cases
1. Document Classification
Automatically apply labels like "Confidential," "Internal," or "Public" to Drive files based on their content type or source, helping teams manage visibility and compliance.
2. Approval Tracking
Label files with custom fields like “Approval Status: Approved/Rejected/Pending” during an approval process, enabling quick filtering and reporting.
3. Project Organization
Apply project-specific labels (e.g., "Project Name," "Phase," "Owner") to files when they are uploaded or created, so all project documents are uniformly tagged.
4. Compliance & Retention
Assign legal or compliance labels such as “Retention Period” or “Regulatory Category” to enforce policies via Drive’s label system.
5. User Assignment
Label files with custom user fields to identify who is responsible for reviewing, editing, or owning the document, especially in collaborative workflows.
6. Timestamping with Metadata
Use a date field in labels to record custom timestamps like "Reviewed On," "Submitted Date," or "Next Review," useful for audit trails.
Inputs
Connection
The Google Workspace connection that authenticates your access to Google Drive. Make sure the connected account has permission to access and modify the target file.
File ID
The unique identifier of the Google Drive file to which you want to apply a label. You can find this ID in the file’s URL or retrieve it using a previous action (e.g., Search File or List Files).
Load Labels (button)
Clicking this button fetches available labels from your Google Drive environment. This helps you browse and select the correct label ID and structure without needing to enter them manually.
Labels
This section allows you to define one or more labels to apply to the file. Each label entry consists of:
-
Label ID:The unique identifier of the label you want to apply. Labels are predefined within your Google Workspace admin console or file metadata management system.
-
Fields (List of Field Objects):Each label can contain one or more fields that hold specific metadata. For each field, provide:
-
Field ID:The unique identifier of the field within the label. This tells Google Drive which specific field you're trying to populate.
-
Field Type:Defines the type of data this field accepts. Supported field types include:
'text'
: Any plain text value.'integer'
: Numeric values (e.g., 42).'dateString'
: A string representation of a date (e.g.,"2024-12-25"
).'selection'
: A value chosen from a predefined dropdown or list.'user'
: User-related metadata like email, display name, or profile photo.
-
Field Value:The actual value you want to assign to this field. For selection-type fields, you can enter multiple options by separating them with commas (e.g.,
Option A, Option B
). Ensure the value matches the field type you selected.
-
🧾 Outputs
After successfully adding a label to a Google Drive file, this action returns structured output data that confirms which label was applied, its current state, and the values set in its fields. These outputs can be used in subsequent actions throughout your flow via the token picker.
Each label object contains the following fields:
1. Label ID
The unique identifier of the label that was added to the file.
Use Case: Useful if you need to verify which specific label was applied or reference it in future steps.
2. Revision ID
Indicates the version (revision) of the label definition at the time it was applied.
Use Case: Helps track label schema changes over time and ensures consistency with other files using the same label.
3. Fields
Each label includes one or more fields containing the actual values you set or retrieved. Each field has the following outputs:
3.1. Field ID
The unique identifier of the field within the label.
Use Case: Useful for identifying specific fields programmatically, especially in dynamic flows or conditional steps.
3.2. Field Type
The type of data held in the field. Valid types include:
dateString
– for date valuesinteger
– for numbersselection
– for dropdown-style optionstext
– for plain textuser
– for assigning or tagging users
Use Case: Enables type-specific handling of field data in your logic.
3.3. Selection Values
The selected values (if any) for fields of type selection
.
Use Case: Indicates which options were chosen in dropdown-type label fields.
3.4. User Values
For fields of type user
, the following user-specific outputs are returned:
- Photo URL: A direct link to the user's Google profile photo, if available.
- User Email: The email address of the user associated with the field.
- Display Name: The user's display name (e.g., "Jane Doe").
Use Case: Enables personalized logic, notifications, or assignments based on who the file is labeled to.
3.5, Date Value
The date value set in the label, returned in ISO format (e.g., 2025-06-16
).
Use Case: Helps drive logic based on review deadlines, expiry dates, etc.
3.6. Number Value
The numeric value stored in fields of type integer
.
Use Case: Ideal for priority levels, version tracking, or any numerical categorization.
3.7. Text Value
The plain text value provided in the label field.
Use Case: Used for descriptions, comments, tags, or other free-form metadata.
Example
Automatically Tag Incoming Reports for Review
Let’s say your team receives monthly financial reports in a shared Google Drive folder. You want to streamline your review process by automatically tagging these files with a custom label indicating:
- The responsible reviewer (user field)
- A deadline for review (date field)
- A status like “Pending” (selection field)
You can set up a flow that detects when a new file is added to the folder, and then uses the "Add Label to File" action to apply a pre-defined “Review Info” label with the relevant values. This helps your team instantly see who’s assigned, when it’s due, and what stage the review is in — all without manually editing file metadata.
This approach keeps everything organized and makes it easy to filter and manage files based on their labels.
Updated about 16 hours ago