# cfxdm - files:loadfile

@**files:loadfile:** It allows users to upload CSV/XLSX/JSON files into AIOps studio for further processing or analysis.

@**files:loadfile:** syntax (parameters)

* **filename**: Mandatory parameter. Enter the filename with path or URL location of the file
* **filetype**: Optional parameter. File type is either csv/json/xlsx. If not specified, it will be derived from the extension.
* **sheet:** Optional parameter. Specify sheet name if the file type is xlsx. If not specified, the first sheet will be returned.

{% hint style="info" %}
The files need to be uploaded to **\~/cfx/cfxdx/home/notebooks** folder from which it can be read and loaded into AIOPs studio using **@files:loadfile** tag.
{% endhint %}

{% hint style="info" %}
Download the [incidents.csv](https://macaw-amer.s3.amazonaws.com/rda/data/incidents.csv) file to the local machine as shown below using a standard web browser. Users can transfer the above dowloaded file to RDA installed machine using standard SFTP/SCP/FTP tools.
{% endhint %}

![CSV file location on the localhost after uload](https://2978683539-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LhoMVYxiQlKXh6OxX98%2F-MbbTPJZVRXmmmkVn48T%2F-MbbTQaj_SKxFScOxMkd%2FScreen%20Shot%202021-06-07%20at%2010.14.52%20AM.png?alt=media\&token=3f2330b3-acc9-48af-99fe-acfb42792d90)

Once the file is uploaded to RDA machine under above explained location, users can load and perform other operations with 'incidents.csv' file (as explained below).

```
> tag @files:loadfile
@files:loadfile> 
@files:loadfile> data filename = '/root/notebooks/incidents.csv'
```

![RDA will load the file incidents.csv via terminal and displays above UI](https://2978683539-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LhoMVYxiQlKXh6OxX98%2F-MbbYR6iwiel-z3ObdZe%2F-MbbYmkI3-vS8Ep8ZCse%2FScreen%20Shot%202021-06-07%20at%2010.39.44%20AM.png?alt=media\&token=eba25a3d-99c3-4573-93d4-ff91a008c7ba)

Below explained tag helps users to save the loaded CSV/XLSX file(s) data into a dataset which can be re-used when needed within the AIOps studio using terminal.

```
@files:loadfile> data filename = '/root/notebooks/incidents.csv' --> @dm:save name = 'incidents-summary'
```

In addition loading CSV files, RDA supports JSON files (format in JSON) as well. Following example shows how to store the above loaded incidents file in CSV format to JSON format.

```
tag *dm:savedlist
*dm:savedlist> data
```

Once users execute the above code using RDA terminal, RDA will print all the stored datasets (including the above stored 'incidents-summary' dataset that was loaded from CSV file.

Once the data is stored in dataset, users can save the dataset into JSON file as shown in the following screenshot.

![Above screenshot displays 'incident-summry' dataset that is stored](https://2978683539-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LhoMVYxiQlKXh6OxX98%2F-MbbrdCRnxg_QK7GwKFe%2F-MbbrxWl0A2018LdfKod%2FScreen%20Shot%202021-06-07%20at%2012.07.46%20PM.png?alt=media\&token=6af30554-d3cc-4fb2-9110-2673024c546c)

Now run the following code snippet to store the dataset into JSON format.

```
tag @dm:recall
@dm:recall> data name = 'incidents-summary' --> @files:savefile filename = '/root/notebooks/incidents.json'
```

Once a user runs the above snippet, the dataset data is stored in JSON file and stored on the file system as mentioned in the above location (shown in the following screenshot).

![Above screenshot disaplays the file location and the JSON format that was stored ](https://2978683539-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LhoMVYxiQlKXh6OxX98%2F-MbcLR7ex3jyD_3Dum7T%2F-MbcLSGhVlin3HHMc2u5%2FScreen%20Shot%202021-06-07%20at%202.20.48%20PM.png?alt=media\&token=06792f3d-cda3-4f79-abad-611868e74429)
