Update Drive File
update_drive_fileUpdate a Google Drive file's content and metadata in place—replace, append, or prepend text, rename, move, trash, or change properties while keeping the same file ID and sharing.
Instructions
Updates metadata, properties, and/or content of a Google Drive file.
Providing one of content, file_path, or file_url replaces the file's
content in place, preserving the existing file ID, sharing, comments, and links.
For native Google Docs/Sheets/Slides the source is uploaded with its source MIME
type so the Drive API applies the same format conversion as import_to_google_doc
(markdown headings, tables, bold, etc.). For any other file (.md, .txt, .pdf, ...)
there is nothing to convert, so the bytes are written back as-is under the file's
own MIME type. Metadata and content can be updated in a single call.
mode='append'/'prepend' splice content onto the file's existing text
server-side, so only the new text has to be supplied — no need to send the whole
file back to rewrite it.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | How to apply the new content — 'replace' (default), 'append', or 'prepend'. Append/prepend require 'content' and a UTF-8 text file such as .md or .txt; a newline is inserted at the seam if neither side has one. For native Google Docs use insert_doc_elements, modify_doc_text, or find_and_replace_doc, which edit in place instead of rewriting the file. | replace |
| name | No | New name for the file. | |
| content | No | New text content for text-based formats (markdown, TXT, HTML). | |
| file_id | Yes | The ID of the file to update. Required. | |
| starred | No | Whether to star/unstar the file. | |
| trashed | No | Whether to move file to/from trash. | |
| file_url | No | Remote http(s) URL to fetch new content from. | |
| file_path | No | Local file path for binary formats (DOCX, ODT). Supports file:// URLs. | |
| mime_type | No | New MIME type (note: changing type may require content upload). | |
| properties | No | Custom key-value properties for the file. | |
| add_parents | No | Comma-separated folder IDs to add as parents. | |
| description | No | New description for the file. | |
| source_format | No | Source format hint for conversion (md, markdown, docx, txt, html, rtf, odt). Auto-detected when omitted, and ignored for non-Google files, which are uploaded without conversion. Provide at most one of content/file_path/file_url. | |
| remove_parents | No | Comma-separated folder IDs to remove from parents. | |
| user_google_email | Yes | The user's Google email address. Required. | |
| writers_can_share | No | Whether editors can share the file. | |
| copy_requires_writer_permission | No | Whether copying requires writer permission. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |