Skip to content

File tools (files.write)

Create folders and files, rename, copy and add to files. Nothing here deletes, moves away or replaces what a file holds. An app has these only if an administrator agreed the files.write change for it and you agreed it when connecting.

Changes thingsScope: files.write

Add rows to the end of an existing CSV or XLSX spreadsheet. Give each row as a list of cell values; quoting is handled for you. At most 10000 rows and 4 MB per call; XLSX files up to 10 MB. Pivot tables in an XLSX are not kept.

ArgumentTypeRequiredWhat it is
sharestringYesThe share’s name or id, from list_shares
pathstringYesPath of the existing CSV or XLSX inside the share
rowslist of arrayYesThe rows to add; each row a list of cell values (text, number, true/false or null)
sheetstringNoXLSX only: the worksheet to add to, by its exact name (default: the first). A name the workbook does not have is refused
Changes thingsScope: files.write

Add text to the end of an existing TXT or MD file (a log, running notes). A line break is put before it if the file does not end with one. For CSV or XLSX rows use append_spreadsheet_rows. At most 4 MB of text per call.

ArgumentTypeRequiredWhat it is
sharestringYesThe share’s name or id, from list_shares
pathstringYesPath of the existing file inside the share
contentstringYesThe text to add
Changes thingsScope: files.write

Copy files (not folders) into a folder, leaving the originals where they are. At most 50 files per call. A name already taken in the destination gets a new name; the result gives each copy’s path. A file too large to copy here (over 64 MB into another share, over 1 GB within one) is not copied: it is listed as failed.

The destination folder must already exist. To copy into another share, pass its name or id as target_share; that share must also be one this app may change.

ArgumentTypeRequiredWhat it is
sharestringYesThe share the files are in, by name or id from list_shares
pathslist of stringYesPaths of the files to copy, inside the share
destinationstringNoThe folder to copy them into; ”/” or empty for the top of the destination share
target_sharestringNoThe share to copy into, if not the same one (default: the same share)
Changes thingsScope: files.write

Create a new file in a folder of a share. It never replaces a file: a name already taken in that folder is refused, so pick another.

Pick format and give the matching body:

  • docx, pdf -> sections (blocks)
  • txt, md, json, html -> content (the text)
  • xlsx, csv -> sheets (array of {name?, headers?, rows})

Section blocks: {“type”:“heading”,“level”:1|2|3,“text”:”…”}, {“type”:“paragraph”,“text”:”…”}, {“type”:“list”,“items”:[”…”],“ordered”:bool?}, {“type”:“table”,“headers”:[”…”],“rows”:[[”…”]]}, {“type”:“page_break”}. Sheets: {“name”:“Sheet1”,“headers”:[“A”,“B”],“rows”:[[“a”,1]]}; csv takes one sheet; at most 10000 rows a sheet.

At most 4 MB of content per call: for more, create the file with the first part and add the rest with append_text_file or append_spreadsheet_rows.

ArgumentTypeRequiredWhat it is
sharestringYesThe share’s name or id, from list_shares
filenamestringYesThe new file’s name; the extension is added from format if missing
formatstringYesOne of: “docx”, “pdf”, “txt”, “md”, “json”, “html”, “xlsx”, “csv”
folderstringNoThe folder to create it in; ”/” or empty for the top of the share (default ”/”)
sectionslist of objectNoFor docx and pdf only
contentstringNoFor txt, md, json and html only
sheetslist of objectNoFor xlsx and csv only
Changes thingsScope: files.write

Create a new folder in a share. A name already taken in that folder is refused.

ArgumentTypeRequiredWhat it is
sharestringYesThe share’s name or id, from list_shares
namestringYesThe new folder’s name (no ”/”)
pathstringNoThe folder to create it in; ”/” or empty for the top of the share (default ”/”)
Changes thingsScope: files.write

Rename one file in a share (not a folder). The new name is a name only, with no ”/”, and must not already be taken in that folder (nothing is replaced).

ArgumentTypeRequiredWhat it is
sharestringYesThe share’s name or id, from list_shares
pathstringYesPath of the file inside the share
new_namestringYesThe new name, including its extension
Changes thingsScope: files.write

Write an earlier version of a file as a NEW file beside it, named like “Report (3 Nov 2026 14.02).docx” (the first free name). Nothing is replaced: the file keeps its current contents, so this is safe on every storage. Take the version_id from list_versions. Replacing the file itself with an old version is not offered here; do that in Foldr.

ArgumentTypeRequiredWhat it is
sharestringYesThe share’s name or id, from list_shares
pathstringYesPath of the file inside the share
version_idstringYesThe version’s id, from list_versions