Unify Logo Footer.svg
Unify Applications
Logo
Export & File Actions

Export & File Actions

Logo

4 mins READ

Actions at a Glance

Action TypeBuilder LabelUse When
exportDataExport DataGenerate a CSV/XLS/XLSX from records bound to a variable or data source
exportBlockExport BlockExport a block as an image (PNG) or PDF
downloadFileDownload FileDownload an existing file from a URL
importObjectsImport ObjectsImport records from a user-uploaded file
copyToClipboardCopy to ClipboardWrite a text or value to the clipboard

exportData — Export Data

Generates a spreadsheet (CSV, XLS, or XLSX) from an array of records and hands it to the user for download. The data is bound via a binding expression — it is not tied to a specific table block. Use it when the file does not yet exist and must be generated from records already in memory or from a data source.

Parameters

ParameterTypeRequiredDefaultDescription
datastring (binding)Required (required)The records to export, bound to a JSON array of objects. For example: {{ table1.rows }} or {{ ds_orders['data'] }}. The action shows an error and stops if this is empty.
fileNamestringOptional (optional)"Untitled"The filename without extension. The file type extension is appended automatically. Supports bindings.
fileType"csv" | "xls" | "xlsx"Optional (optional)"csv"The output file format.
sheetNamestringOptional (optional)"Sheet1"For XLS/XLSX: the name of the worksheet tab. Ignored for CSV.
columnsarrayOptional (optional)All keysAn array of column definitions specifying which fields to include and how to label them. If omitted, all fields from the data are included.

Examples

Export a table's current rows as CSV

{ "actionType": "exportData", "payload": { "data": "{{ ds_orders['data'] }}", "fileName": "orders-{{ utils.formatDate(new Date(), 'YYYY-MM-DD') }}", "fileType": "csv" } }

Export as XLSX with a custom sheet name

{ "actionType": "exportData", "payload": { "data": "{{ var_reportData['value'] }}", "fileName": "Monthly Report", "fileType": "xlsx", "sheetName": "Sales Summary" } }

exportBlock — Export Block

Exports a block on the page as a visual file — a PNG image or a PDF. Useful for generating shareable screenshots of charts, dashboards, or data tables without leaving the app.

Parameters

ParameterTypeRequiredDefaultDescription
blockIdstringRequired (required)The ID of the block to export. Any block on the current page can be targeted.
fileType"png" | "pdf"Optional (optional)"png"The export format.
fileNamestringOptional (optional)"export"The filename without extension. Supports bindings.

Note: Alternative: You can also call the built-in exportBlock method on any block via controlBlockMethod with methodName: "exportBlock".

Export a chart as PNG

{ "actionType": "exportBlock", "payload": { "blockId": "b_salesChart", "fileType": "png", "fileName": "sales-chart-{{ utils.formatDate(new Date(), 'YYYY-MM') }}" } }

downloadFile — Download File

Downloads an existing file from a URL to the user's device. Use this when the file already exists at a URL (e.g. a document stored in a cloud bucket). For generating a new file from records, use exportData instead.

Parameters

ParameterTypeRequiredDefaultDescription
urlstring (URL)Required (required)The URL of the file to download. Supports bindings for dynamic file URLs.
fileNamestringOptional (optional)From URLThe filename to save the download as. If omitted, the filename is inferred from the URL.

Download a row's attached document

{ "actionType": "downloadFile", "payload": { "url": "{{ row.attachmentUrl }}", "fileName": "{{ row.documentName }}.pdf" } }

importObjects — Import Objects

Processes a file uploaded by the user and imports its records into a target data source or object store. Use it to power "Import from CSV" workflows where users upload spreadsheet data that gets written to the app's backend.

Parameters

ParameterTypeRequiredDefaultDescription
fileUploadBlockIdstringRequired (required)The ID of the File Upload block that holds the file to import.
objectTypeIdstringRequired (required)The object type (entity/model) to import records into.
fieldMappingsarrayOptional (optional)Array of { sourceColumn, targetField } mappings that specify how spreadsheet columns map to object fields.

Import contacts from a CSV upload

{ "actionType": "importObjects", "payload": { "fileUploadBlockId": "b_csvUpload", "objectTypeId": "contact", "fieldMappings": [ { "sourceColumn": "Email", "targetField": "email" }, { "sourceColumn": "Name", "targetField": "displayName" } ] } }

copyToClipboard — Copy to Clipboard

Writes a text value to the clipboard so the user can paste it into another application. Common use cases include copying an order number, a link, an API key, or any computed value.

Parameters

ParameterTypeRequiredDefaultDescription
valuestringRequired (required)The text to copy to the clipboard. Supports bindings. Non-string values are coerced to strings.
successMessagestringOptional (optional)Optional confirmation message shown (as a toast) after the copy succeeds.

Note: Clipboard access requires user gesture. Browsers restrict programmatic clipboard writes to user-initiated events (clicks, key presses). Calling this action from an automated trigger (e.g. onPageLoad) will silently fail in most browsers.

Examples

Copy an order number with confirmation toast

{ "actionType": "copyToClipboard", "payload": { "value": "{{ row.orderNumber }}", "successMessage": "Order number copied to clipboard" } }

Copy a shareable link

{ "actionType": "copyToClipboard", "payload": { "value": "https://app.example.com/orders/{{ row.id }}" } }

Choosing the Right Action

ScenarioUse
Export rows from a data source to a spreadsheetexportData
Download a file that already exists at a URLdownloadFile
Save a chart or table as an image/PDFexportBlock
Import records from a user-uploaded fileimportObjects
Let users copy a value to their clipboardcopyToClipboard