Skip to content

Google Drive

The Google Drive component lets you pull files or whole folders from your Google Drive account into Nappai. You can choose a single file, a folder, or feed it data that already contains file IDs. The component then returns the file contents as text data or the file metadata and content as separate file objects.

⚠️ DEPRECATION WARNING

This component is deprecated and will be removed in a future version of Nappai. Please migrate to the recommended alternative components.

How it Works

When you drop the component onto the canvas, it first checks which input you have provided:

  1. File or Folder Selection – If you pick a file or a folder, the component uses the Google Drive API to fetch the chosen items.
  2. Data with File – If you feed it a list of data objects that already contain a file ID or folder ID, the component looks up those IDs and loads the corresponding files.
  3. File Type Filter – You can limit the search to documents, sheets, PDFs, or all supported file types.
  4. Download Content – If you want the actual file data (e.g., images or PDFs) in the output, enable this option.

The component authenticates with Google using a Google Drive credential that you set up in the Credentials section. It then calls the Google Drive API, downloads the requested files, and returns them either as plain text data (for documents, sheets, PDFs, etc.) or as file objects that include the file’s name, URL, MIME type, and optional content.

Inputs

  • Data with file (HandleInput):
    Provide a list of data objects that already contain a file ID or folder ID. The component will load the files referenced by those IDs.

  • Select file (FileInput):
    Choose a single file from your Google Drive. Supported file types are: txt, pdf, docx, xlsx, pptx, md, csv, png, jpg, jpeg, gif, bmp, tiff, svg, webp.

  • or Select folder (FileInput):
    Choose a folder from your Google Drive. The component will recursively load all files inside that folder that match the selected file type.

  • File Id Key (StrInput):
    The key name that holds the file ID in the data objects you pass through Data with file. Default is file_id.

  • Folder Id Key (StrInput):
    The key name that holds the folder ID in the data objects you pass through Data with file. Default is folder_id.

  • Download File content (BoolInput):
    When checked, the component will download the actual file content (useful for images, PDFs, etc.) and include it in the Files output.

  • File Type (DropdownInput):
    Choose which types of files to load: all, document, sheet, or pdf. The component automatically adjusts the internal file filter based on this choice.

Credential
This component requires a Google Drive credential.

  1. Go to the Credentials section of Nappai and create a new credential of type Google Drive.
  2. Provide the Client Id, Client Secret, and select the appropriate Google drive access level.
  3. In the component, choose the credential you just created from the Credential dropdown.

Outputs

  • Data (Data, method: fetch_content):
    Returns a list of data objects where each object contains the text content of a file and its metadata (name, source URL, etc.).

  • Files (Data, method: result_file):
    Returns a list of file objects that include the file ID, name, URL, MIME type, and optionally the file content if Download File content is enabled.

Usage Example

  1. Load a single PDF

    • Drag the component onto the canvas.
    • In the Select file field, pick a PDF from your Drive.
    • Set File Type to pdf.
    • Leave Download File content unchecked.
    • Connect the Data output to a text‑processing component to extract information from the PDF.
  2. Load all documents in a folder

    • Choose a folder in or Select folder.
    • Set File Type to document.
    • Enable Download File content if you need the raw file data.
    • Use the Files output to pass the files to a downstream component that uploads them to another system.
  • Google Sheets Reader – Reads data directly from Google Sheets into structured tables.
  • Google Drive Writer – Uploads files or folders back to Google Drive.
  • File Processor – Performs transformations on file data (e.g., OCR, image resizing).

Tips and Best Practices

  • Use File Type to limit the number of files fetched; this speeds up the operation and reduces API usage.
  • If you only need the text content, leave Download File content unchecked to avoid downloading large binary files.
  • When feeding data through Data with file, make sure the key names match the ones you set in File Id Key and Folder Id Key.
  • Keep your Google Drive credential up to date; if you change the access level, update the credential in Nappai.

Security Considerations

  • The component uses OAuth credentials stored in Nappai’s secure credential store.
  • Ensure that only authorized users have access to the Google Drive credential.
  • The component does not store any downloaded files permanently; it only passes them through the workflow.