ONLYOFFICE DocSpace icon

ONLYOFFICE DocSpace

Consume ONLYOFFICE DocSpace API

File → Download File

AI-generated

Summary

Downloads a file from ONLYOFFICE DocSpace by ID and returns it as binary data on the item, optionally converting it to another format or to text (.csv/.txt).

Inputs

  • authentication (required) — Credential type used for the request: API Key, Basic Auth, OAuth2, or Personal Access Token.
  • fileId (required) — Numeric ID of the DocSpace file to download.
  • asText (required) — If true, downloads as .csv or .txt. A file that is already .csv/.txt is downloaded as-is. Otherwise the node picks .csv or .txt from the file type's convertible formats, and errors with 'File could not be converted to text' if neither is available.
  • outputFormat — Shown only when As Text is off. Target extension, chosen from a list of formats the file can convert to, or typed manually. Leave empty to keep the original format.
  • binaryPropertyName (required) — Name of the output binary field that receives the file. Defaults to 'data'.

Output shape

One item per input item. The file is in the binary field named by 'Put Output File in Field', with file name and MIME type set. The original input JSON and any existing binary fields are kept.

If the input item's JSON is empty, the file's info record is used as the JSON, with fields such as title, fileExst and id. When a conversion is applied, the file name uses the original title with the new extension. The node starts a bulk-download operation and polls for up to about 2 seconds (20 attempts at 100 ms), so large files or slow conversions can fail with 'Timeout waiting for operations to finish'. With Continue On Fail enabled, a failed item returns JSON of {error: message}.

Examples

Example 1: Download a document as-is and attach it to an email.

Set File ID to the document ID, As Text off, Output Format empty, Put Output File in Field 'data'.

Example 2: Convert a DOCX to PDF for archiving.

Set File ID, As Text off, Output Format to '.pdf' (from the list or manually), binary field 'data'.

Example 3: Extract spreadsheet content as text for parsing.

Set File ID, As Text on. The node downloads a .csv (or .txt) version in the 'data' binary field.

Links

Discussion