
## output


Your scripting extension can output rich information to show your users what's happening while your script runs,
or to display custom analysis of the data in your base. Output is done through the built-in `output` object.



Your scripting automation action can output data. Output is done through the built-in `output` object.
Data that you output will be available to subsequent automation steps within the template expression UI. Click on the
blue '+' icon or type '{' and select the output key that you would like to use.


### text (extensions only)

```js
async function (source: unknown) => Promise<void>;
```

| Parameter name | Description |
|---|---|
| `source` | The text to display on-screen. Non-string types are converted to strings. |

Displays the given text on-screen.

```js
output.text('Hello, world!');
```

Outputs:

> Hello, world!

### markdown (extensions only)

```js
async function (source: string) => Promise<void>;
```

| Parameter name | Description |
|---|---|
| `source` | The Markdown to display on-screen. |

Displays the given [Markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) on-screen.

```js
output.markdown('Hello, *world*!');
```

Outputs:

> Hello, *world*!

```js
output.markdown(`
**Base name**

The name of the current base is '${base.name}'.
`);
```

Outputs:

> **Base name**
>
> The name of the current base is 'Projects'.

### table (extensions only)

```js
async function (data: unknown) => Promise<void>;
```

| Parameter name | Description |
|---|---|
| `data` | The array or object to display on-screen. |

Outputs arrays or objects as tables. It mirrors the [console.table](https://developer.mozilla.org/en-US/docs/Web/API/Console/table) API.

```js
output.table(['hello', 'world']);
```

Outputs:

| | Values |
|---|---|
| 0 | hello |
| 1 | world |

```js
output.table([
    {name: 'Guthrie', age: 5, type: 'cat'},
    {name: 'Amber', age: 4, type: 'dog'},
]);
```

Outputs:

| | name | age | type |
|---|---|---|---|
| 1 | Guthrie | 5 | cat |
| 2 | Ambder | 4 | dog |

### inspect (extensions only)

```js
async function (object: unknown) => Promise<void>;
```

| Parameter name | Description |
|---|---|
| `object` | The object to inspect. |

Takes any data from your program and outputs an interactive inspector for exploring it.
This is useful for debugging your script as you write it.

### clear (extensions only)

```js
async function () => Promise<void>;
```

Clears all previous output.



### set (automations only)

```js
function (key: string, value: unknown) => void;
```

| Parameter name | Description |
|---|---|
| `key` | The key to set in the output object. |
| `value` | The value to set for the given key (must be JSON-serializable). |

Sets a property in the object output by the script. If a value was already set for the given key, it
will be overwritten with the new value.

```js
output.set('foo', 42);
```
