Choose where you’d like to start

Get File Content

Note:
  • This function is applicable to all Zoho services.
  • In Zoho Creator, this function can only be applied on files fetched using the invokeUrl task and not on the files fetched from Zoho Creator fields. To fetch content of the files uploaded in the file upload field, use content.​

Description

The getFileContent task is used to get the content of the specified file.

Syntax

<response> = <file_object>.getFileContent();

where,

ParamsData typeDescription

<response>

TEXT

specifies the response returned by the getFileContent task. It represents the content of the file.

<file_object>

FILE

specifies the file object whose content has to be fetched. The file can be fetched from the cloud using the invokeUrl task.

File types that usually contain only text values, (for example .txt, .csv etc.) will return the content accurately. File types that usually contain images, (for example .pdf, etc.) will return junk values.

Example

The following script returns the content of the file that the variable - fileVariable holds.

 // to fetch file from the cloud using invokeUrl task
 fileVariable = invokeUrl
 [
  url: "http://insight.dev.schoolwires.com/HelpAssets/C2Assets/C2Files/C2ImportCalEventSample.csv"
  type: GET
 ];
 
 // to fetch the file content
 response = fileVariable.getFileContent();

where,

response
is the TEXT response returned by the getFileContent task. It represents the content of the specified file.
fileVariable
is the FILE variable that holds the file whose content needs to be fetched

Related Links

Get Started Now

Execute