Skip to main content

TransformScript

Files TransformScript is a language built into Files.com for transforming and reshaping file data as it moves through your workflows. You write a short script that reads an incoming file, changes it into the shape another system expects, and produces a new file. It runs inside Automations and other parts of the platform, so you can convert and clean up data at the moment files cross between partners and systems, without sending them out to a separate integration tool first.

Files rarely arrive in the exact format the next system needs. A partner sends CSV when your application wants JSON, field names don't match, dates use the wrong format, or one document has to become many records. TransformScript handles that translation in place: read the file in one format, enrich and restructure it, and write it back out in another.

TransformScript is one of several Files.com features for processing files automatically. If you're not sure it's the right fit, see Comparing TransformScript to Related Features below.

What You Can Do With TransformScript

A TransformScript reads a file, transforms it, and writes the result. Within that, you can:

  • Convert between formats such as JSON, CSV, XML, YAML, and the EDI and HL7 standards used in business and healthcare.
  • Reshape records into the exact structure a downstream system expects, renaming fields and restructuring nested data.
  • Normalize and enrich values, standardizing dates, currencies, and identifiers, or adding context from earlier workflow steps.
  • Filter, group, join, and aggregate records.
  • Call AI to extract structured fields from messy input, classify documents, or summarize content, with the result fed back into the workflow. AI in TransformScript is in Limited Preview; contact your Account Manager for access.

The Shape of a TransformScript

A TransformScript has a header for settings such as the output format, a --- separator, and an expression that produces the result:

%files 1.0
output json
---
{ message: "Hello, " ++ payload.name }

The expression after the --- is where the work happens. It reads from a small set of inputs and builds the output you want. For the full structure, see Writing a TransformScript.

The Inputs You Work With

A script runs with a few inputs already available:

  • payload is the file's contents, parsed according to its format. A JSON file arrives as an object, a CSV file as an array of rows, an EDI file as a structure of segments.
  • attributes is information about the workflow run.
  • vars holds values passed from earlier steps in the workflow.

You don't manage parsing, output formatting, or performance. Files.com reads the incoming file, hands you payload, serializes whatever your script returns, and runs it at scale.

Editing and Testing Scripts

You write and edit TransformScripts in the Files.com web interface or through the API. The browser-based editor lets you run a script against sample input and see the output immediately, so you can build and validate a transformation before putting it into a live workflow.

Common Use Cases for TransformScript

Customers use TransformScript wherever incoming files have to be reshaped before another system can use them. Finance teams convert partner remittance files into the record layout their accounting system imports. Healthcare organizations translate HL7 messages into JSON for an internal application. Retailers normalize sales feeds from many stores into one consistent schema. Logistics partners exchange EDI purchase orders and invoices and map them to and from internal formats.

For examples you can adapt, see the Cookbook.

TransformScript reshapes the contents of a file. Other Files.com features move and route files without changing what's inside them. Use the one that matches the job, or combine them.

TransformScript vs. Automations

Automations move, copy, rename, and organize files based on triggers. They control where a file goes and what it's called, and they can rename files and build destination paths from variables. They don't change the data inside the file. Use an Automation to route a file; use TransformScript when the contents have to change. The two work together: an Automation can run a TransformScript as part of a workflow, transforming a file and then delivering the result.

TransformScript vs. iPaaS Integrations

Files.com integrates with iPaaS platforms such as Boomi, Mulesoft, and Zapier. Those platforms transform data in a separate system, after the file leaves Files.com. TransformScript does the transformation inside Files.com, at the point of transfer, so you don't stand up and maintain a separate pipeline for format conversion and field mapping. Use an iPaaS integration when the work belongs in a broader external workflow you already run there; use TransformScript when you want the transformation to happen in place.