Skip to main content

Google Drive Integration

Want your agents to work with cloud documents? Connect Google Drive to SmythOS and give your agents the power to upload, fetch, and manage files—automatically.

TL;DR

Link your Google account to SmythOS once. Then use Drive components to upload, list, and interact with files from your Google Drive in real-time.

List of Google Drive Components

ComponentActionWhat it DoesInputsKey OutputsUse Case
Upload FileWriteUploads a file to a Google Drive folder.file, folderId, fileName, mimeTypedriveFile, responseSave a generated report or PDF to Drive.
List FilesReadRetrieves a list of files within a folder.folderIdfiles, responseList recent uploads for user access or logic branching.
Get File MetadataReadFetches metadata (name, size, mimeType) for a given file ID.fileIddriveFile, responseDisplay file info before download or share.
INFO
Why Use Google Drive With SmythOS?

Google Drive lets your agents access documents as inputs and store generated files as outputs:

  • Upload generated PDFs, reports, or scraped content
  • Reference files dynamically via fileId or folderId
  • Use metadata for filtering, naming, or logic branching
  • Store agent logs, archives, or deliverables for human review

Prerequisites

You’ll need:

  • A SmythOS account (sign up here)
  • A Google account with access to Drive
  • Appropriate access to the target files and folders

Connect Google Drive to SmythOS

The integration requires a simple one-time authorization.

Step 1: Add a Drive Component

From the SmythOS Integrations panel, drag in any Google Drive component like "Upload File".

Step 2: Authenticate

You can connect your Google account in two ways:

Option A: Click the Authenticate Button

Option B: Use Component Settings Open any Drive component → Settings tab → Find the OAuth section → Click Authenticate.

You’ll be prompted to:

  1. Choose your Google account
  2. Grant permission for file access
  3. Return to SmythOS—authentication complete 🎉
Switching Accounts or Resetting Connection?

To switch accounts, de-authenticate from the Drive integration settings. Then re-authenticate with your desired Google account.

Component Details

Upload File — Send Files to Google Drive

Upload a file from your agent’s workflow to a specific Google Drive folder.

INFO

Use this to store AI-generated content like PDFs, spreadsheets, or reports.

Inputs

FieldRequiredNotes
filerequiredFile object to upload (e.g., from previous component like HTML-to-PDF).
folderIdrequiredTarget folder’s Drive ID.
fileNamerequiredDesired name of the file in Drive (e.g., summary.pdf).
mimeTyperequiredMIME type (e.g., application/pdf, text/plain).

Outputs

FieldDescription
driveFileObject with uploaded file’s metadata: name, id, mimeType, webViewLink.
responseFull API response from Google Drive.
headersHTTP headers from Drive API response.
Use Case

Convert a markdown blog post into PDF, then upload it to your team’s shared Drive folder for review.

{ "component": "drive.uploadFile", "file": "{{pdf_output}}", "folderId": "1A2B3FolderID", "fileName": "Monthly_Report_June.pdf", "mimeType": "application/pdf" }
Troubleshooting

Missing file? Double-check your MIME type and ensure the file object is populated.

List Files — Get Files in a Folder

Retrieves all visible files inside a specified folder.

Inputs

FieldRequiredNotes
folderIdrequiredID of the folder to list contents from.

Outputs

FieldDescription
filesArray of file objects with IDs, names, mimeTypes.
responseRaw API response from Drive.
headersHTTP metadata headers.
Use Case

List all submissions in a shared folder, then loop over them for processing.

{ "component": "drive.listFiles", "folderId": "SharedSubmissionsFolder123" }
Troubleshooting

Empty array returned? Check that your Google account has permission to view the folder contents.

Get File Metadata — Inspect a Drive File

Fetch information about a Drive file using its fileId.

Inputs

FieldRequiredNotes
fileIdrequiredUnique ID of the file you want to inspect.

Outputs

FieldDescription
driveFileMetadata including name, mimeType, modifiedTime, size.
responseRaw response from Drive API.
headersHTTP headers.
Use Case

Use this to verify a file’s type or timestamp before processing it in a workflow.

{ "component": "drive.getFileMetadata", "fileId": "1XyzABCDriveFileId" }
Troubleshooting

Getting 403 errors? Make sure the file isn’t in trash or shared only with other users.

Best Practices

  • Use fileId and folderId dynamically from previous steps to avoid hardcoding
  • Only request scopes you need (e.g., Drive file access vs full Drive control)
  • Store sensitive folder IDs in SmythOS Vault for reusability
  • Clean up stale or temporary files by chaining a [Delete File] component (coming soon)

Troubleshooting Tips

404 Errors?
→ Double-check fileId or folderId and ensure the file is shared with your connected account.

Permission Denied?
→ Re-authenticate and confirm that consent was granted to view/edit files.

Wrong file format?
→ Be sure to set mimeType correctly (e.g., application/json, text/csv).

INFO

Still stuck? Inspect the response field for a detailed error from the Drive API.

What's Next?

You’ve successfully integrated Google Drive with SmythOS!

Now try building an agent that:

  • Uploads a file after parsing web content
  • Lists files, filters them by name, and downloads specific reports
  • Uses driveFile.webViewLink to send the user a view-only version of the file
  • Combine this with Google Sheets Integration