Add Label to File

Definition

The "Add Label to File" action in Zenphi allows you to programmatically assign metadata labels to files stored in Google Drive. These labels help categorize, organize, and manage files by applying structured information—such as status, department, date, or custom tags—directly to the document. This action supports both manual entry of label IDs and automated selection via the "Load Labels" feature, ensuring flexibility in setup.

This is especially useful for compliance workflows, document management, access control, and content lifecycle tracking—all while maintaining alignment with Google's native labeling system.


Example of use cases

1. Document Approval Workflow

Automatically label documents as "Approved", "Pending Review", or "Rejected" based on decisions made in the flow, helping teams quickly identify a file’s status.

2. Departmental Tagging

Apply labels like "Finance", "HR", or "Legal" to files uploaded via a form, ensuring they are sorted and retrievable based on the relevant department.

3. Compliance Classification

Tag sensitive documents with labels such as "Confidential", "Internal Use Only", or "Public" to meet organizational compliance and data governance policies.

4. Project Organization

Automatically label project files with project codes or milestone statuses like "Design Phase", "In Development", or "Completed" to maintain clarity across teams.

5. Content Review Tracking

Track file review cycles by labeling files with fields like "Last Reviewed Date" or reviewer’s name using the dateString and user field types.



🧾 Inputs

This action requires specific information to identify the target file and apply labels accurately. Here's a breakdown of each input field:

1. Connection

The Google Workspace connection used to authenticate and interact with Google Drive. You must have access to the file you're labeling.

2. User Email

The email address of the user who is performing the label action. This is used to apply labels on behalf of a specific user, ensuring correct permissions and audit trails.

3. File Id

The unique ID of the file on Google Drive that you want to label. This ID can be extracted from a file picker, dynamic lookup, or pulled from a previous step in the flow.

4. Load Labels Button

Clicking this button retrieves available labels from your Google Workspace environment. It helps pre-fill the Labels Section with selectable labels and their fields, avoiding manual entry errors.

🏷️ Labels Section

This is where you define the labels to apply to the file. Think of it like tagging a file with structured information. A file can have multiple labels, and each label can have multiple fields (metadata points).

Here’s how the label structure works:

🔹 Label (Object)

Represents one label to apply to the file. It includes:

Label ID

The identifier of the label you want to apply. This can be selected from the loaded labels or entered manually. Labels are created and managed in your Google Workspace Admin console.

🔸 Fields (List inside Label)

Each label can have a list of fields that capture different kinds of metadata. For example, if a label is "Project Info", fields might be "Project Name", "Due Date", etc.

Each Field includes:

Field ID

The unique identifier of the specific field inside the label (e.g., status, due_date). This tells the system which piece of information you’re updating.

Field Type

Defines the data type expected for the field. Options include:

  • dateString: A date in string format (e.g., 2024-12-31)
  • integer: A whole number (e.g., 10)
  • selection: A dropdown-like field with predefined options (e.g., Approved, Rejected)
  • text: Freeform text input
  • user: A Google Workspace user email address

Field Value

The value you're assigning to the field. For example:

  • A status field might be: Approved
  • A due date field: 2024-05-01
  • A user field: [email protected]

You can add multiple fields per label to capture complex metadata.


✅ Example Structure Summary

File
 └── Label 1 (e.g., "Document Status")
      ├── Field: status = "Approved" (type: selection)
      └── Field: reviewer = "[email protected]" (type: user)

 └── Label 2 (e.g., "Project Info")
      └── Field: due_date = "2024-05-10" (type: dateString)


📄 Example: Automating Document Classification in HR

An HR team maintains a Google Drive folder containing employee documents (e.g., contracts, evaluations). As new documents are added or updated, a Zenphi flow automatically:

Detects the file.

Adds a "Document Type" label with a field like contract, review, or offer letter.

Sets another label like "Review Status" with a field value of Pending or Approved.

✅ This helps the team quickly search, filter, and track documents by type and status—without manual tagging.