# Update File — Google Drive

> Update a file's metadata and/or content. See the documentation for more information

- Key: `google_drive-update-file`
- Type: Action (Write)
- Version: 2.0.17
- App: Google Drive (`google_drive`) — https://pipedream.com/apps/google-drive.md
- This page (HTML): https://pipedream.com/apps/google-drive/actions/update-file
- Hints: destructive · open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/google_drive/actions/update-file/update-file.mjs

## Description

Update a file's metadata and/or content. [See the documentation](https://developers.google.com/drive/api/v3/reference/files/update) for more information

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `drive` | `string` | No | Select a specific drive to search. Defaults to All Drives (My Drive and all Shared Drives you have access to) when no selection is made. To limit to your personal drive or a Shared Drive, select it from this list. Options are loaded from the connected account. |
| `fileId` | `string` | Yes | The file to update Options are loaded from the connected account. |
| `filePath` | `string` | No | The file content to upload. Provide either a file URL or a path to a file in the /tmp directory (for example, /tmp/myFile.txt) |
| `name` | `string` | No | The new name of the file |
| `mimeType` | `string` | No | The file's MIME type (e.g., image/jpeg). The value cannot be changed unless a new revision is uploaded. Options are loaded from the connected account. |
| `addParents` | `string[]` | No | A list of parent folder IDs to add Options are loaded from the connected account. |
| `removeParents` | `string[]` | No | A list of parent folder IDs to remove Options are loaded from the connected account. |
| `keepRevisionForever` | `boolean` | No | Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Google Drive. Only 200 revisions for the file can be kept forever. If the limit is reached, try deleting pinned revisions. |
| `ocrLanguage` | `string` | No | A language hint for OCR processing during image import (ISO 639-1 code) |
| `useContentAsIndexableText` | `boolean` | No | Whether to use the uploaded content as indexable text |
| `advanced` | `object` | No | Any additional parameters to pass in the request. See the documentation for all available parameters. |
| `syncDir` | `dir` | No | SyncDir |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
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 accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_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_drive",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "google_drive-update-file",
  arguments: {
    drive: "Drive",
    fileId: "File",
  },
})
```

**TypeScript**

```ts
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_drive-update-file",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    google_drive: { authProvisionId: "apn_xxxxxxx" },
    drive: "Drive",
    fileId: "File",
  },
})

console.log(result)
```

**cURL**

```bash
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_drive-update-file",
    "configured_props": {
      "google_drive": { "authProvisionId": "apn_xxxxxxx" },
      "drive": "Drive",
      "fileId": "File"
    }
  }'
```

---

- App: https://pipedream.com/apps/google-drive.md · All apps: https://pipedream.com/apps
