CONNECT APP
Build with Google Docs
File Storage
- OAuth
MCP
Give your agent Google Docs tools
Every Google Docs action is exposed as an MCP tool on Pipedream's remote server. Point a client at it with your end user's ID and Connect resolves that user's Google Docs account for each tool call — you store no tokens.
// accessToken: mint a short-lived token with the Connect SDK — see the MCP guide
const transport = new StreamableHTTPClientTransport(
new URL("https://remote.mcp.pipedream.net/v3"),
{
requestInit: {
headers: {
Authorization: `Bearer ${accessToken}`,
"x-pd-project-id": "{project_id}",
"x-pd-environment": "production",
"x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
"x-pd-app-slug": "google_docs",
},
},
},
)
const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)
const { tools } = await mcp.listTools()
// e.g. run Append Text:
const result = await mcp.callTool({
name: "google_docs-append-text",
arguments: {
docId: "Document",
text: "Text",
},
})# access_token: mint a short-lived token with the Connect SDK — see the MCP guide
headers = {
"Authorization": f"Bearer {access_token}",
"x-pd-project-id": "{project_id}",
"x-pd-environment": "production",
"x-pd-external-user-id": "{external_user_id}", # any stable ID for this user in your system
"x-pd-app-slug": "google_docs",
}
async with streamablehttp_client("https://remote.mcp.pipedream.net/v3", headers=headers) as (read, write, _):
async with ClientSession(read, write) as session:
await session.initialize()
tools = await session.list_tools()
# e.g. run Append Text:
result = await session.call_tool("google_docs-append-text", {
"docId": "Document",
"text": "Text",
})API PROXY
Call the Google Docs API directly
For an endpoint with no pre-built tool, the Connect proxy forwards your request to the Google Docs API with the connected user's credentials attached. You store no tokens and write no refresh logic.
const resp = await pd.proxy.get({
externalUserId: "{external_user_id}", // any stable ID for this user in your system
accountId: "apn_xxxxxxx",
url: "https://www.googleapis.com/drive/v3/about?fields=user",
})
// Any allowed Google Docs endpoint works here. Pipedream attaches the
// connected account's credentials to the outgoing request.# The path segment is the target URL, URL-safe base64 encoded:
# https://www.googleapis.com/drive/v3/about?fields=user
curl "https://api.pipedream.com/v1/connect/{project_id}/proxy/aHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vZHJpdmUvdjMvYWJvdXQ_ZmllbGRzPXVzZXI?external_user_id={external_user_id}&account_id=apn_xxxxxxx" \
-H "Authorization: Bearer {access_token}" \
-H "x-pd-environment: production"SDK
Run Google Docs actions from your backend
Connect a user's Google Docs account once, then run Append Text on their behalf from your own code — TypeScript, Python, or plain HTTP.
import { PipedreamClient } from "@pipedream/sdk"
const pd = new PipedreamClient({
projectId: process.env.PIPEDREAM_PROJECT_ID!,
clientId: process.env.PIPEDREAM_CLIENT_ID!,
clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
projectEnvironment: "production",
})
const result = await pd.actions.run({
id: "google_docs-append-text",
externalUserId: "{external_user_id}", // any stable ID for this user in your system
configuredProps: {
google_docs: { authProvisionId: "apn_xxxxxxx" },
docId: "Document",
text: "Text",
},
})from pipedream import Pipedream
pd = Pipedream(
client_id="{oauth_client_id}",
client_secret="{oauth_client_secret}",
project_id="{project_id}",
project_environment="production",
)
result = pd.actions.run(
id="google_docs-append-text",
external_user_id="{external_user_id}", # any stable ID for this user in your system
configured_props={
"google_docs": {"authProvisionId": "apn_xxxxxxx"},
"docId": "Document",
"text": "Text",
},
)curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
-H "Content-Type: application/json" \
-H "X-PD-Environment: production" \
-H "Authorization: Bearer {access_token}" \
-d '{
"external_user_id": "{external_user_id}",
"id": "google_docs-append-text",
"configured_props": {
"google_docs": { "authProvisionId": "apn_xxxxxxx" },
"docId": "Document",
"text": "Text"
}
}'TOOLS
Google Docs actions
On-demand operations your product or agent can configure and run on behalf of a connected user.
-
Append Text
actionAppend text to an existing document. See the documentationWritev0.1.17 -
Create Document
actionCreate a new Google Doc with an optional body. The body is rendered as Markdown, so you can include headings (# Title), bold/italic, bullet/numbered lists, links, and code. Optionally place the doc in a specific Drive folder. Returns{documentId, title, url}. See the documentationWritev1.0.7 -
Append Image to Document
actionAppends an image to the end of a document. See the documentationWritev0.0.11 -
Apply Bullets
actionTurn paragraphs into a bulleted or numbered list in a Google Doc. Locate the paragraphs with Find Text, or pass an explicit Start Index and End Index. Every paragraph the range touches becomes a list item. Use Remove Bullets to undo. See the documentationWritev0.0.3 -
Create Document From Template
actionCreate a new Google Doc by copying a template document and substituting{{placeholder}}tokens with values. Use Find Document to resolve the template's name to its ID. Returns{documentId, title, url}. See the documentationWritev1.0.7 -
Create Tab
actionAdd a new tab to an existing Google Doc and return its Tab ID. The tab is created empty; pass the returnedtabIdas Tab ID to Insert Text, Write Table, Insert Image, Insert Table or Insert Page Break to fill it, because an edit sent without a Tab ID always goes to the document's first tab. Added at the end of the document's tabs unless Position is set, and nested under another tab when Parent Tab ID is set. Use List Tabs to see the tabs a document already has, or Find Document to resolve a document's name to its ID. Position applies only to the tab being created: this tool set cannot rename, reorder or delete a tab that already exists — say so plainly rather than attempting a workaround such as recreating the tab. See the documentationWritev0.0.1 -
Delete Table
actionRemove an entire table, structure and contents, from the document. Use this to clear a table completely, including an empty table left behind after its text was removed. Set Table Number to pick which table to remove (1 = first top-level table in the document, in reading order; a table nested inside another table's cell doesn't count separately). Use Get Document first if you need to confirm how many tables exist. This also works on a table linked to a Google Sheet, since removal is treated as ordinary content deletion. Use Find Document to resolve a document's name to its ID. In a multi-tab document, set Tab ID to choose which tab to delete from — without it the first tab's tables are the ones counted and removed; use List Tabs to get the IDs. See the documentationWritev0.1.0 -
Export Document
actionExport (download) a Google Doc to a file in PDF, DOCX, TXT, HTML, or ODT format. Use Find Document to resolve a document's name to its ID. The file is written to the workflow's temporary storage and a presigned download URL is returned to the caller. Returns{filePath, filename, mimeType}. See the documentationRead-onlyv0.0.8 -
Find Document
actionSearch for Google Docs by name or full-text content. Returns a list of{id, name, url, modifiedTime}. Use this first to resolve a document's name to its ID, then pass theidto Get Document, Export Document, or any of the insert/replace tools. See the documentationRead-onlyv1.0.7 -
Format Paragraph
actionApply paragraph formatting (heading style, alignment, line spacing, indentation) in a Google Doc. Locate the paragraph with Find Text, or pass an explicit Start Index and End Index. Google Docs applies paragraph styles to whole paragraphs, so every paragraph the range touches is restyled, not just the matched text. See the documentationWritev0.0.3 -
Format Table Cell
actionSet the background, borders, padding, or vertical alignment of table cells in a Google Doc. Identify the table with Find Table Text, Table Index, or leave both blank when the document has only one table. Styles every cell unless Row Index and Column Index name a starting cell. See the documentationWritev0.0.3 -
Format Text
actionApply character formatting (bold, italic, underline, strikethrough, font, size, color, link) to text in a Google Doc. Locate the text with Find Text, or pass an explicit Start Index and End Index. Use Find Document to resolve a document's name to its ID. See the documentationWritev0.0.3 -
Get Document
actionGet the full text content and structure of a Google Doc by its ID. Returns the document body plus a flattenedtextContentfield for easy reading. A Google Doc can hold several tabs:body/textContentare always the first tab's content, and every tab is listed intabs(with each tab's owntextContentwhen the document has more than one), so a single call shows all of the document's text. Pass a Tab ID from that list to get one tab's full structure on its own. Optionally supply afieldsmask to request a partial (e.g. metadata-only) response and skip the body-text enrichment. Use Find Document first to resolve a document's name to its ID. See the documentationRead-onlyv1.2.0 -
Get Profile
actionGet the identity (display name and email) of the currently authenticated Google account. Use this to answer "who am I" questions and to attribute documents to the current user. Resolves via the Driveabout.getendpoint (no extra OAuth scope required). See the documentationRead-onlyv0.0.8 -
Get Tab Content
actionGet the content of a tab in a document. See the documentationRead-onlyv0.0.4 -
Insert Image
actionInsert an inline image into a Google Doc from a publicly reachable image URL. The URL must be publicly accessible (Google fetches it server-side) and point to a PNG, JPEG, or GIF. Use Find Document to resolve a document's name to its ID. In a multi-tab document, set Tab ID to choose which tab receives the image — without it the image goes into the document's first tab; use List Tabs to get the IDs. See the documentationWritev0.1.0 -
Insert Page Break
actionInsert a page break into a Google Doc at the beginning, end, or a specific character index. Use Find Document to resolve a document's name to its ID. In a multi-tab document, set Tab ID to choose which tab receives the page break — without it the break goes into the document's first tab; use List Tabs to get the IDs. See the documentationWritev1.1.0 -
Insert Table
actionInsert an empty table with the given number of rows and columns into a Google Doc. If you already have the data, use Write Table instead so you don't have to fill cells one by one. Use Find Document to resolve a document's name to its ID. In a multi-tab document, set Tab ID to choose which tab receives the table — without it the table goes into the document's first tab; use List Tabs to get the IDs. See the documentationWritev1.1.0 -
Insert Text
actionInsert text into a Google Doc at the beginning, end, or a specific character index. Use Find Document to resolve a document's name to its ID. To append text to the end of a doc, useposition: end(the default). In a multi-tab document, set Tab ID to choose which tab receives the text — without it the text goes into the document's first tab; use List Tabs to get the IDs. See the documentationWritev1.1.0 -
List Comments
actionList the comments on a Google Doc, including each comment's author, plain text and HTML content, the document text it is anchored to, whether it is resolved, and its full reply thread. Comments on a Doc are served by the Drive API, so the document ID doubles as the file ID. Use Find Document first to resolve a document's name to its ID. See the documentationRead-onlyv0.0.5 -
List Tabs
actionList the tabs in a Google Doc — each tab's ID, title, position and nesting. A Google Doc can hold many tabs, and an omitted Tab ID means different things per operation: content writes (Insert Text, Insert Table, Insert Image, Insert Page Break, Write Table, Delete Table) go to the first tab; Replace Text replaces in every tab; the styling tools (Format Text, Format Paragraph, Format Table Cell, Apply Bullets, Remove Bullets) cover every tab when the target is located by Find Text, but only the first tab when given explicit indices. So call this first whenever the job names a tab ("add this to the Budget tab") or the document might have more than one. Returns{documentId, tabCount, tabs: [{tabId, title, index, nestingLevel, parentTabId}]}, in document order, with each parent followed by its nested child tabs. Pass atabIdfrom this list to Get Document to read one tab, or to Insert Text, Write Table, Insert Image, Insert Table, Insert Page Break, Delete Table or Replace Text to edit one. Use Find Document to resolve a document's name to its ID. This tool set can list tabs, add a tab (Create Tab) and read or write a named tab; it cannot rename, reorder or delete an existing tab — say so plainly rather than attempting a workaround. See the documentationRead-onlyv0.0.1 -
Remove Bullets
actionRemove bullets or numbering from list paragraphs in a Google Doc, leaving the text in place. Locate the paragraphs with Find Text, or pass an explicit Start Index and End Index. Every paragraph the range touches is affected. See the documentationWritev0.0.3 -
Replace Image
actionReplace image in a existing document. Works on multi-tab documents: pass a Tab ID, or leave it blank and the tab holding the image is found automatically. See the documentationWritev0.1.0 -
Replace Text
actionFind and replace all occurrences of a string in a Google Doc. Set Replacement Format tomarkdownto convert Markdown in the replacement into native Google Docs formatting. Use Find Document to resolve a document's name to its ID. Returns the number of replacements made. In a multi-tab document the replacement runs across every tab by default; set Tab ID to confine it to one tab, using List Tabs to get the IDs. See the documentationWritev1.2.0 -
Write Table
actionCreate a table and fill it with data in a single step. Provide the entire table (all rows and columns, including a header row) at once. Use this instead of inserting cells or text one at a time. The action places every value in the correct cell for you. Pass Table Data as a JSON array of arrays, one inner array per row, header row first when Has Header Row is set, e.g.[["Name","Role"],["Ada","Engineer"]]. Use Find Document to resolve a document's name to its ID, or Insert Table instead if you only need an empty grid to fill in later. In a multi-tab document, set Tab ID to choose which tab receives the table — without it the table goes into the document's first tab; use List Tabs to get the IDs. Note: a table written this way is always static — the Google Docs API does not create or preserve a live link to a Google Sheet, even when this replaces a Sheets-linked table. See the documentationWritev0.1.0
EVENTS
Google Docs triggers
Event sources your backend can deploy for users and receive through a webhook.
MULTI-APP
Use Google Docs with other popular apps
Most products don't stop at one integration. Pair Google Docs with the other apps your users rely on, and ship use cases that span both.
- App slug
- google_docs
- Authentication
- OAuth
- Categories
- File Storage
- Actions
- 25
- Triggers
- 2
- API proxy
- Available
OAuth scopes
These are the scopes Pipedream's managed Google Docs OAuth client requests when one of your users connects an account. Supply your own OAuth client to request a different set.
- https://www.googleapis.com/auth/drive