Automatically map columns for headless data import workflows in Flatfile with configurable confidence levels
automap
function accepts an AutomapOptions
configuration object with the following parameters:
'confident'
: All mapped fields must have a confidence level of ‘strong’ (> 90%) or ‘absolute’ (100%)'exact'
: All mapped fields must have a confidence level of ‘absolute’ (100%)test()
against this regexdebug
is truetrue
disables this behaviordefaultTargetSheet
to dynamically route data to different sheets based on the filename.
debug: true
option in the configuration. This will provide a step-by-step log of the plugin’s execution, including:
matchFilename
is provided, the plugin will attempt to automap every uploaded filedefaultTargetSheet
for basic workflows, as the plugin cannot map single-sheet files automatically without ittargetWorkbook
is not specified, the plugin filters out file-associated workbooks and selects the remaining one, or the one with the ‘primary’ label if multiple existjob:completed:file:extract
to start the process, and job:updated:workbook:map
to check the mapping plantargetWorkbook
works best when there’s a clear primary workbook in the spaceaccuracy
check is all-or-nothing. If even one column mapping does not meet the required confidence level, the entire automatic mapping job is abortedtry/catch
blocks and logs errors to the console, which are more verbose when debug
is set to true
onFailure
callback, which is triggered when mapping confidence is too low. This allows you to implement custom notification systems or alternative workflows when automatic mapping cannot proceed.