This is legacy documentation maintained for backward compatibility. For the latest documentation, please visit our current guides.
The DevXP engineering team hosts office hours every Thursday at 11 a.m.
Pacific Time where we answer your questions live and help you get up and
running with Flatfile. Join
us!
A key component of Flatfile’s headless automation workflow is the automapping
functionality provided by our
Automap Plugin.Upon uploading a file, after file extraction is complete, the data needs to be
mapped to a destination Workbook. In a non-headless environment a human might do
this manually. But in a headless environment, we’ll automate this process.We’ll use Automap to do this for us.
Next, configure the plugin. Choose an accuracy level, a default target sheet,
and a regex expression to test incoming files.accuracy: either confident or exact defaultTargetSheet: the name of the sheet you want to map to matchFilename: regex that will match on incoming files
Copy
Ask AI
import { automap } from "@flatfile/plugin-automap";export default function flatfileEventListener(listener) { listener.use( automap({ accuracy: "confident", defaultTargetSheet: "Contact", matchFilename: /^.*contacts\.csv$/, onFailure: (event) => { console.error( `Failed to automap! Please visit https://platform.flatfile.com/s/space/${event.context.spaceId}/files?mode=import to manually import file.`, ); }, }), );}
Note you may also set debug to true for useful error messages in
development.