Save Files

Definition

The "Save Files" action in the Google Drive category enables you to upload and save multiple files to a specified folder in Google Drive. By providing file payloads and the unique ID of the target folder, this action streamlines the process of organizing and storing files in a structured way. It is highly versatile, supporting multiple file types and offering detailed output metadata for each saved file. Key capabilities include batch file uploads, precise folder targeting using folder IDs, and returning rich metadata for further automation or reporting.

Example Use Cases

1. Archiving Processed Documents

Automatically save processed invoices, reports, or contracts into a designated Google Drive folder for easy access and organization.

2. Backup Uploaded Files

Store user-uploaded files from a form or application into a specific folder for backup and record-keeping purposes.

3. Organizing Workflow Outputs

Save generated files, such as PDFs or images, from other automation actions into Google Drive folders categorized by project, client, or date.

4. Centralized File Management

Collect and store files from multiple sources or workflows into a single folder, making them accessible to team members via shared Google Drive links.

5. Batch File Uploads for Distribution

Upload multiple files generated during a workflow, such as marketing materials or reports, into a shared folder for distribution to stakeholders.

Inputs

1. Connection

Specifies the Google Drive connection to use for saving the files.

  • Usage: Select or configure the connection to your Google Drive account. Ensure that the connection has the necessary permissions to access and upload files.

2. File Payloads

A collection of file payloads or a comma-separated list of payloads representing the actual file contents.

  • Usage: Select the file payloads from previous actions in the workflow, such as uploaded files, generated reports, or downloaded documents.

3. Output Folder Id

The unique identifier (ID) of the Google Drive folder where the files will be saved.

  • Usage:
    • Locate the folder ID from the URL of the folder in Google Drive.
    • Example: If the URL is https://drive.google.com/drive/u/0/folders/1h_fzGyzOimMfEjdhXp6jhUkA-A01kHrR?lfhs=2, the folder ID is 1h_fzGyzOimMfEjdhXp6jhUkA-A01kHrR.
    • You can also click the Google Drive icon in the field, which will open your Google Drive page. From there, simply select the desired folder in the interface.

Step-by-Step Guide

Follow these steps to demonstrate how to use the action effectively in a flow:


Step 1: Add the Action to Your Flow

  1. Open your Zenphi flow editor.
  2. Drag and drop the Save Files action from the Google Drive category into your flow.

Step 2: Configure the Connection

  1. Click on the Connection field.
  2. Select an existing Google Drive connection or create a new one by providing the necessary credentials and permissions.

Step 3: Specify the File Payloads

  1. In the File Payloads field, select the files you want to save.
    • Example: Choose file outputs from a previous action like "Generate PDF" or "Extract Attachment."
  2. If there are multiple files, ensure they are comma-separated or grouped as a collection.

Step 4: Set the Output Folder Id

  1. Navigate to the target folder in your Google Drive.
  2. Copy the folder ID from the URL as described in the Inputs section.
  3. Paste the folder ID into the Output Folder Id field.

Step 5: Test and Save the Flow

  1. Save your flow and run a test to ensure the action saves the files to the specified folder.
  2. After execution, check the target folder in Google Drive to verify the files were uploaded successfully.

Outputs

The Save Files action provides detailed output data about the files that were uploaded to Google Drive. Below is an explanation of the output fields:


Files

This output contains an array of drive file objects, where each object represents a saved file. The key attributes of each file object include:

  • Id: The unique identifier of the saved file in Google Drive.
  • Description: Any description metadata associated with the file.
  • Name: The name of the file in Google Drive.
  • MIME Type: The type of file (e.g., application/pdf, image/jpeg).
  • Version: The version number of the file in Google Drive.
  • View Link: A direct link to view the file in Google Drive.
  • Original Filename: The name of the file before it was uploaded.
  • File Extension: The extension of the file (e.g., .pdf, .jpg).
  • Download Link: A link to download the file.
  • Size: The size of the file in bytes.
  • Trashed: A boolean indicating if the file is in the trash.
  • Modified Time: The timestamp of the last modification made to the file.
  • Created Time: The timestamp of when the file was created.
  • Owners: Details about the file owner(s), including:
    • Display Name: The owner's name.
    • Email Address: The owner's email address.
  • Parents: An array containing the IDs of the parent folders.
  • Shared: A boolean indicating if the file is shared.
  • Saved File: A flag to confirm the file was successfully saved.

These outputs can be used for:

  • Logging file details for audit purposes.
  • Providing file links or metadata to downstream actions.
  • Verifying successful uploads in complex workflows.

Example: Automating File Uploads for Employee Onboarding

In an employee onboarding process, various documents such as offer letters, policy manuals, and training schedules need to be stored in Google Drive for each new hire. Using the Save Files action, you can automate this process as follows:

  1. Collect Files: Gather the necessary documents as file payloads from previous actions, such as generating PDFs or receiving files via a form.
  2. Specify Output Folder: Use a dynamic folder ID to save the files in a specific Google Drive folder, such as a folder named after the employee's name or ID.
  3. Save and Retrieve: Automatically upload the files and retrieve their Google Drive links to share with the HR team or the new hire.

This ensures efficient file management and eliminates manual uploads, saving time and reducing errors.