File Utility Methods
FILEUTILITY
contains methods which are helpful for parsing data from file formats like CSV and JSON. These methods return the parsed data in JSON format which is suitable to be used with controls on the UI builder.
FILEPARSER
FILEUTILITY.FILEPARSER
method can be used to parse files of multiple different formats and get output into JSON format. This method returns a Promise
. The accepted file formats include csv
, xml
and json
.
Parameter | Accepts | Possible values |
---|---|---|
url | String | any valid url for csv, json or xml file |
FILEUTILITY.FILEPARSER(url);
await FILEUTILITY.FILEPARSER("https://dronamobilepublic.s3.amazonaws.com/DRONA5_Team19020/content/app/images/UiFhDLxjT5.csv");
PARSEXLSX
FILEUTILITY.PARSEXLSX
method can be used to parse excel sheets and get output into JSON format. This method returns a Promise
. The accepted file format is xlsx
. The second parameter sheetNumber
is optional. If your excel file has multiple sheets, you can specify the sheet number which you want to parse. By default the utility will parse the first sheet.
FILEUTILITY.PARSEXLSX(url,sheetNumber);
Parameter | Accepts | Possible values |
---|---|---|
url | String | any valid url for xlsx file |
sheetNumber (Optional) | Number | any numerical value |
await FILEUTILITY.PARSEXLSX('https://dronamobilepublic.s3.amazonaws.com/DRONA5_Team19020/content/app/images/WKEa5OPsEw.xlsx');
DOWNLOADFILEAS
FILEUTILITY.DOWNLOADFILEAS
method can be used to download json data into different file formats. The supported file formats are json
, csv
and xml
.
FILEUTILITY.DOWNLOADFILEAS(data,format);
Parameter | Accepts | Possible values |
---|---|---|
data | Json array | array of json objects |
format | String | 'json','csv','xml' |
FILEUTILITY.DOWNLOADFILEAS(data,'csv');