Skip to content

Make files in a run

An automation often ends with a file someone needs: a spreadsheet of checked shipments, a packing list to print, a label with a barcode. Four blocks make files from data earlier steps produced, and the trigger can hand those files back to whoever started the run. This guide is for authors building those automations.

Block Makes
Write Excel An Excel workbook from rows, with a bold header, a filter and real dates.
Write CSV A plain CSV file from rows, for systems that import CSV.
Create PDF A PDF, such as an invoice, packing list or letter, from a template and your data.
Create barcode A QR code or barcode image, to put in a PDF, attach to an email or store.

Every file a block makes is an output, like any other value. Later blocks can attach it to an email, write it to storage, or return it from the run.

Write Excel and Write CSV take the same Rows: a Table or a List of Records from an earlier step, such as Select Rows, Parse CSV, or the Results of a For each loop. Each record becomes one row, and the first row holds the column names.

  1. Add Write Excel, or Write CSV for a file another system imports.
  2. Set Rows to the table or list.
  3. Set File name. Type @ to put values from the run in it, such as an order number. The .xlsx or .csv ending is added when it’s missing. Left empty, the file is rows.xlsx or rows.csv.

The block writes every column it gets, in order. To keep only some columns or change their order, build the rows first with Set Value and For each, one record per row with the fields you want. To keep only some rows, use Select Rows.

Write Excel keeps text as text, so a commodity code keeps its leading zero and nothing in a cell runs as a formula. Dates in a date column become Excel dates. Write CSV puts a ' in front of text that starts like a formula, such as = or +, so a spreadsheet shows it instead of running it.

Either file holds up to 500,000 rows and 50 MiB. Over either limit, the step fails and writes nothing. The block’s Row count output says how many rows it wrote.

Create PDF fills a template with your data. It suits documents with a fixed layout: invoices, packing lists, delivery notes, letters.

  1. Add Create PDF.
  2. Under Named inputs, add each value the document needs and give it a name, such as order, lines or logo. A record becomes something the template reads as order.number; a list becomes rows you can repeat; a file, such as a logo, becomes an image the template can place.
  3. Write the Template. It is written in Typst, a markup language for documents, and sets the page size, margins, fonts, headers, footers and page numbers.
  4. Set File name, for example packing-list-{{order.number}}.pdf. Empty uses document.pdf.

Create PDF won’t publish while a named input is empty: enter a value for each one, or remove it.

A file input, such as a logo, can come from an earlier step, including a File cell of a table such as Read Reference Table › Table › #1 › Logo, or be uploaded on its row. If that row or cell has no file, the step fails and names the input. Open the row’s … menu and choose Upload file…; the row then shows the file’s name and size, and Clear value removes it. The file is kept with the automation, and each published version keeps the files it uses. You can also ask the workspace Agent to attach a file from the chat to a row. A duplicated block gets its own copy of the file. An automation you import, or start from a template, leaves the file out: the row says it needs an upload, and the automation can’t be published until you upload the file.

You don’t need to write Typst yourself. Ask the workspace Agent to make the template: it starts from ready templates for an invoice, a packing list and a commercial invoice, makes a draft run and opens the PDF to check it before it hands it back.

A long table carries on over as many pages as it needs and repeats its header row on each. Fonts are Noto Sans, Noto Serif and Noto Sans Mono. A template can’t read other files, load web addresses or import packages, and a template error stops the step and names the line.

A PDF can take up to 30 seconds and run to 500 pages and 50 MiB. PDFs are made one at a time, alongside Extract document text, so a step may wait for its turn.

Create barcode turns a reference, link or ID into a code a scanner can read.

  1. Add Create barcode before Create PDF.
  2. Set Text, for example the order reference.
  3. Pick the Type: QR code for any text, including links; Code 128 for letters and digits; or Data Matrix, EAN-13, GS1-128 or PDF417 when a label standard asks for one.
  4. Pick the Format: SVG stays sharp at any size and suits PDFs; PNG suits email and label printers.

To print it in the PDF, add the barcode’s Image to Create PDF’s Named inputs, for example as code, and place it in the template with #image(code, width: 60mm). The template sets the printed size.

Text a type can’t hold, such as letters in an EAN-13, stops the step and says why.

The packing list comes back under the form when the run ends.

An Operation trigger can give the person who submitted the form what the run made:

  1. Open the trigger.
  2. Under Returned files, pick the files, such as Create PDF’s PDF or Write Excel’s File.
  3. Under Returns, add any values to show with them, such as Write Excel’s Row count.

When the run ends, the values and files show under the form, in the editor’s Run window and at the top of the run page, where people can preview and download them. They say how long they’re kept.

To send a file instead, attach it in Send email. To keep it in your own storage, use Write object.

Make a draft run with sample data, then open the step in the run and look at the file it made. See Runs in the editor. Open a spreadsheet in the program your team uses, and print a label once to check that the scanner reads it at the size you set.

Last updated: