Google Drive integration
Bring selected or accessible supported Drive files into MemorySync for document retrieval. Retrieve supported document and PDF content, together with supported file metadata, from the content available to the connection.
Pick the right file set
Supported document and PDF content
Selected or accessible supported files available to the connection.
Supported document content extracted for retrieval.
Supported PDF content and supported file metadata.
Connection planning checklist
- A Google account with access to the intended files.
- Permission to connect that account under your organization’s policy.
- A MemorySync project for the imported document knowledge.
Check items for your own planning. Nothing here changes a live connection.
0 of 4 planning steps complete
File synchronization lifecycle
- 1Connect an account
Use an account that can access the intended files.
- 2Select or confirm access
Keep the available file set aligned with the use case.
- 3Extract and synchronize
Process supported documents, PDFs, and metadata through synchronization.
- 4Retrieve
Query the imported document knowledge.
Extractable and non-extractable content
Supported documents and PDFs with extractable text can become retrievable content.
A file without supported extractable text cannot provide searchable document text.
Verify document retrieval
Query a distinctive phrase from a known supported document or PDF that the connected account can open. Confirm the result is from the intended file set.
Troubleshooting and related sources
Why is a file missing?
Confirm the connected account can open it and that the file is selected or otherwise accessible to the connection.
Why did selecting a folder import little or nothing?
Google’s file-level permission model grants access per selected item, so picking a folder does not automatically grant its contents. Select the individual files you want imported.
Why does a document or PDF have no searchable text?
Verify that the file is supported and contains text that can be extracted.
What should I do after access changes?
Review the content available to the connected account, then verify synchronization with a known supported file.
Operations on this page
| Operation | Method and path | Python | Node.js |
|---|---|---|---|
| Picker configuration | GET …/{connection_id}/gdrive/picker-config | connections.gdrive.picker_config | connections.gdrive.pickerConfig |
| List selected resources | GET …/{connection_id}/gdrive/resources | connections.gdrive.resources | connections.gdrive.resources |
| Select resources | POST …/{connection_id}/gdrive/resources | connections.gdrive.add_resources | connections.gdrive.addResources |
| Deselect a resource | DELETE …/{connection_id}/gdrive/resources/{resource_id} | connections.gdrive.remove_resource | connections.gdrive.removeResource |
Authentication and scope
| Requirement | Contract |
|---|---|
| Credential | An API key sent as X-API-Key. Connector operations are not end-user scoped. |
| Read scope | integrations:read for every GET. |
| Write scope | integrations:write for every POST, PUT, PATCH and DELETE. |
| Tenant | Derived from the authenticated key. There is no tenant parameter to pass or to get wrong. |
X-End-User-ID | Not used. A connection belongs to the organization, not to one end user. |
Before you start
You need an active Google Drive connection from the OAuth flow on Providers & OAuth. Drive cannot be connected with an API key.
1. Get the picker configuration
Returns what the browser-side Google Picker needs: the app id, the developer key, and the OAuth token scoped to this connection. Fetching it from your server and handing it to the picker means your page never holds a long-lived Google credential.
import osfrom memorysync import MemorySyncClientclient = MemorySyncClient(api_key=os.environ["MEMORYSYNC_API_KEY"],base_url="https://api.memorysync.io",)config = client.connections.gdrive.picker_config("conn_8f21a4")# Serialise this to the browser that renders the picker.print(config["app_id"], config["client_id"], config["scope"])
| Field | Passed to the Picker as |
|---|---|
app_id | The Google Cloud project number. |
client_id | The OAuth client id. |
api_key | The browser API key. This is the Picker's developerKey. |
oauth_token | The access token scoped to this connection. |
scope | The scope the token carries, so the picker can request a matching view. |
2. Select files and folders
Selecting a folder selects its contents, and MemorySync keeps following that folder — files added to it later are picked up by later syncs. Selecting a file selects only that file.
import osfrom memorysync import MemorySyncClientclient = MemorySyncClient(api_key=os.environ["MEMORYSYNC_API_KEY"],base_url="https://api.memorysync.io",)client.connections.gdrive.add_resources("conn_8f21a4",resources=[{"id": "1AbCdEfGhIjKlMnOpQrStUvWxYz", "type": "folder", "name": "Handbook"},{"id": "1ZyXwVuTsRqPoNmLkJiHgFeDcBa", "type": "file", "name": "Pricing.pdf"},],)
3. Read back the selection
Like the Slack channel list, this returns a bare JSON array rather than an object with a resources key.
import osfrom memorysync import MemorySyncClientclient = MemorySyncClient(api_key=os.environ["MEMORYSYNC_API_KEY"],base_url="https://api.memorysync.io",)for resource in client.connections.gdrive.resources("conn_8f21a4"):print(resource["resource_id"], resource["resource_type"], resource["name"], resource["permission_state"])
| Field | Meaning |
|---|---|
resource_id | Drive's own file or folder id. |
resource_type | Whether it is a file or a folder. |
name, mime_type | Drive metadata. Both nullable. |
web_view_link, icon_url | Links for showing the item back to a user. |
permission_state | Whether the connection can still read it. This is where a revoked share shows up. |
is_active, last_synced_at | Whether future syncs read it, and when it was last read. |
4. Sync and check the formats
Trigger a sync on Sync & Jobs. Google-native documents are exported before parsing; binary formats are parsed as they are. A format with no parser produces an object with no memories rather than an error, which is why an empty result is worth checking rather than assuming a failure.
| Drive content | How it is read |
|---|---|
| Google Docs | Exported to text, then extracted. |
| Google Sheets | Exported to tabular data; see structured_stats on the object. |
| Google Slides | Exported to text per slide. |
| PDF, DOCX, PPTX, XLSX | Parsed directly by the same parsers as file upload. |
| Images, audio, video | Read only where a transcriber is configured; otherwise no memories. |
| Shortcuts and shared links | Followed only if the connection's token can read the target. |
5. Deselect a resource
Stops future syncs reading it. Existing objects and memories are kept.
import osfrom memorysync import MemorySyncClientclient = MemorySyncClient(api_key=os.environ["MEMORYSYNC_API_KEY"],base_url="https://api.memorysync.io",)client.connections.gdrive.remove_resource("conn_8f21a4", "1ZyXwVuTsRqPoNmLkJiHgFeDcBa")
Errors and next action
| Status | Meaning | Next action |
|---|---|---|
401 | Missing, malformed or inactive API key. | Check server configuration without printing the key. |
403 | The key lacks integrations:read or integrations:write. | Grant the scope on the key, or use a key that has it. |
404 | The connection, object or job is not visible to this tenant. | Confirm the identifier belongs to this organization. |
409 | The connection is in a state that forbids the operation. | Read the connection status first and act on it. |
429 | Rate limited, either by MemorySync or by the upstream provider. | Back off; do not tighten a polling loop in response. |
5xx | Service failure. | Treat a write outcome as uncertain and reconcile by reading the connection back. |