Choose where you’d like to start

Convert to File

Description

The toFile 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 which usually contain only text values, for example .txt, .csv etc., will return the content accurately. File types which usually contain images, for example .pdf, 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