Upload file content
upload_fileUpload a file to Google Drive using inline text or a local path, create a new file or replace an existing one, and return its metadata. Supports optional conversion to Google Docs, Sheets, or Slides.
Instructions
Uploads content to Drive and returns the file's metadata. Without file_id it CREATES a new file (name required; parent_id places it); with file_id it REPLACES that file's content in place (same id, new bytes) — name/parent_id are ignored then. The bytes come from exactly one of content (inline UTF-8 text) or local_path (absolute path to a local file). mime_type describes the uploaded bytes (default: text/plain for content, guessed from the extension for local_path). convert_to=document|spreadsheet|presentation imports the bytes into an editable Google Doc/Sheet/Slides (e.g. a .docx or .csv becomes native; export back with export_file). Cap: 5 MB per upload (multipart) — larger files need a resumable session via raw_request. A retry after an ambiguous failure without file_id would create a duplicate — search_files first.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | File name in Drive — required when creating (no file_id). | |
| content | No | Inline UTF-8 text content — for small text files. Exactly one of content/local_path. | |
| file_id | No | Existing file whose CONTENT to replace (omit to create a new file). | |
| mime_type | No | mimeType of the uploaded bytes (default: text/plain for content, extension-based for local_path). | |
| parent_id | No | Folder for the new file (create only; omitted = My Drive root). | |
| convert_to | No | Import into a Google-native editable file: document (Doc), spreadsheet (Sheet), presentation (Slides). | |
| local_path | No | Absolute local path to read the bytes from. Exactly one of content/local_path. |