Browse documentation

File-triggered workflows

Kick off a workflow automatically when a file arrives, and label the files it receives.

A workflow can start on its own the moment a file lands in your workspace. This connects the Files area to the Workflows area: a file arriving is an event, and a workflow can listen for it. The listener is the File Received trigger, which fires for a file whether it was uploaded on the Files page or pushed over Managed SFTP. A file attached in a thread or uploaded into a task starts no workflow.

Only workflows that are Active and not archived are started. See Build a workflow for activating one.

Choose at upload whether workflows run

Uploads from the Files page let you decide whether an arriving file may start a workflow:

  • From the New dialog. Each file under Selected files says how many workflows it would start, for example 1 workflow to be triggered; hover the badge to see their names and status. Leave the Trigger workflows checkbox selected to let them run, or clear it to store the files quietly. It is on by default.
  • By dropping files on the list. SPARK asks once for the whole drop, and only when a workflow would start: Upload and run starts them, Upload only stores the files without starting anything.

See Organize files for both ways to upload.

Upload FilesDrag and drop your files here or click to browse.Drag and drop files or a folder hereCSV, TXT, PDF, XLSX, XLS, DAT, MD, JSON, DOCX,PPTX, PNG, JPG, JPEG, WEBP files, or click to browseSelected fileskestrel-global-equity-nav.csv0.5 KB1 workflow to be triggeredmonth-end-checklist.md0.2 KBNo workflows to be triggeredLabelsTrigger workflowsCancelSubmit (2 files)
Each file says what it would start. Leave Trigger workflows on to let them run.

Files that arrive over SFTP or by email have no such question: a matching workflow always starts.

Match the right files

The File Received trigger does not fire for every file. Select the trigger on the workflow canvas and narrow it in the side panel so only relevant files start a run:

SectionSettingMatches on
File ExtensionA pick from csv, txt, pdf, xlsx, xls and dat, or Custom... for any other, such as jsonThe file's extension, given without its dot
File Matching Logic, Pattern builder tabStarts withA prefix on the file name
Name includesA substring anywhere in the file name
Ends withA suffix on the whole file name, the extension included
File Matching Logic, Regular Expression tabRegular expressionA pattern matched anywhere in the file name, for example ^invoice_\d{4}.*\.csv$
ProviderA provider nameRecorded on the trigger

How the matching works:

  • Every condition you fill in must match. Leave one empty and it is ignored.
  • Matching reads the name the file was uploaded with, and ignores upper and lower case throughout, the regular expression included.
  • A regular expression matches anywhere in the name unless you anchor it with ^ and $. One that does not compile starts nothing.
  • The Provider field does not filter which files start the workflow.

A workspace can therefore hold many file-triggered workflows that each react to a different kind of file. A file that matches several of them starts each one.

ConfigureExecutionsFile ReceivedTriggerStart the run when a matching file arrivesFile ExtensionFile extension to filter by (e.g., 'csv', 'json')csvFile Matching LogicPattern builderRegular ExpressionDefine patterns to match incoming file names.Starts with2023_Name includesNAVEnds with_backupProviderName of the data provider (e.g., 'delegate_name')delegate_name
The File Received trigger: filter by extension, a name pattern (or regex), and provider.

SPARK does not drop a repeated file. Each copy is stored and starts the workflow again, so make re-processing safe where the data lands, for example with Replace Existing Records on a Save Record step.

Build the workflow

The trigger is one action in a larger flow. Add a File Received trigger as the workflow's starting action, set its conditions, then add the steps that read, transform or load the file:

For the mechanics of assembling actions, see Build a workflow.

Label the files a run received

The Apply File Label action labels the files that reached it, so arrivals can be grouped, filtered and found later by the feed they came from. It is in the Data group of the node picker. In its side panel, you write rules, each one a short sentence:

  1. Click Add rule.
  2. Choose what the rule matches: Every file, Name contains (with the text to look for, for example NAV), or Name matches (a regular expression, marked advanced, for example ^NAV_\d{8}\.csv$).
  3. After the arrow, pick the labels a matching file earns.

Add as many rules as you need. One workflow can then serve several feeds: a File Received trigger watching a whole SFTP folder feeds one Apply File Label step, which tags each file with the feed it came from.

How the rules apply:

  • Rules are additive. A file gets the labels of every rule it matches, not only the first, so a NAV file that is also a month-end file can carry both labels. A file that matches no rule is left unlabelled.
  • Name contains ignores upper and lower case. Rules read the name the file was uploaded with.
  • By default the labels are added to the ones the file already has. Turn on Replace Existing to replace them instead. Adding is the safer choice when one file can start several workflows, since replacing would let two of them drop each other's labels.
  • Labels are given by name, so the same workflow works unchanged in every workspace. Each label must already exist: a name the workspace does not have fails the run with Unknown file label(s), so create labels on the Files page first.

A rule is Every file, Name contains or Name matches (marked advanced), then the text, then the label it gives, picked from the workspace's existing file labels. A rule that is half finished, with no text or no label yet, is not saved, and the panel says what it is missing: Fill in the text and pick a label. (or Pick a label to apply. for Every file).

ConfigureExecutionsApply File LabelDataLabel incoming files by rules on their namesData Sources0 / 1Rules*Each rule adds its labels to the files it matches. A file can match more thanone rule and gets the labels from all of them.Name containsNAVValuationEvery fileCashAdd ruleReplace ExistingOff: add to the labels the file already has. On: replace them.Off
Apply File Label: one rule per label, and whether to add or replace.

Where to go next