# setScript method

Information note**STABLE.**   
  
This API is reliable and breaking changes are unlikely.

qlik.app.setScript(script)

Sets the data load script of this app. Also validates the script syntax and returns the syntax errors if errors exist.

## Version history

Version history

| Version state | Details |
| --- | --- |
| Introduced | Qlik Sense June 2017 |

## Parameters

### script

Type: String

The script content.

## Returns

A promise of an empty object or a list of syntax errors depending on the validation result.

## Examples

Example 1

This example loads data from an Excel spreadsheet.

```
var script = "LOAD Sales FROM [lib://data/sample.xlsx];";
var app = qlik.openApp("2abac31e-3b46-4b78-8bxf-c5cea1d2514d", config);
app.setScript(script).then( function(result){
  console.log(result);
});
```

Example 2

This example loads the data, from a shortened version of the prepared test script, inline.

```
var script = "Load Chr(RecNo()+Ord('A')-1) as Alpha, RecNo() as Num autogenerate 26;"
var app = qlik.openApp("2abac31e-3b46-4b78-8bxf-c5cea1d2514d", config);
app.setScript(script).then( function(result){
  console.log(result);
});
```