getEmbeddedTextFile(path, id, [encoding]) Last updated: 27. Oct 2026
Get the text content of an embedded file in a specific document.
See also: getEmbeddedFile saveEmbeddedFile Path traversal
Parameters
| Name | Type | Description |
|---|---|---|
| path | string | Absolute path of Docly document to get embedded text file from. |
| id | string | ID of embedded file to get text content from. |
| encoding (optional) | string | Text encoding: UTF8 (default), UTF-8, UTF7, UTF32, Unicode, BigEndianUnicode, ASCII or Default. Not case sensitive. An unknown name throws error -901. |
Returns
The content of the embedded file as a string. null when the document or the embedded file does not exist, or when the path or id is invalid (.., a backslash, or characters not allowed in a file name).
Example
Code example (JS)
JS is normal JavaScript either running in the browser or on the Docly™ server.// Read a CSV file uploaded to the field "File" of a document
let path = "Imports/Prices";
let doc = docly.getFile(path);
let text = docly.getEmbeddedTextFile(path, doc.File, "UTF8");
for (let line of text.split("\n"))
write(line + "<br>");