Returned Data

After the user has finished mapping, fixing and reviewing their imported data, they will click the complete button. This action sends the data to your application by resolving the .requestDataFromUser() promise and triggering a complete event. The output is simply a key-value map. Each row of the data becomes a javascript object, and the keys you configured are used as keys for the output data.

For a complete list of results available in Flatfile, check our SDK Reference.

Using Promise chaining

importer.
.requestDataFromUser()
.then(function(results) {
importer.displayLoader()
setTimeout(() => { // simulation of handling results asynchronously
importer.displaySuccess('Success!')
const tasks = results.validData
}, 1500)
})
.catch(function(error) {
console.info(error || 'window close')
})

Using async/await

const results = await importer.requestDataFromUser()

Multi Value Support

Coming in V2. If you configure a field with allowMultiple: true, the value will always be returned as an array. This is helpful when a user wants to do something like map multiple phone number columns to your phone number field. This also will automatically extract multiple values if more than one exists in a column.

{
name: "John Doe",
phone: ["+1 234 567 8901", "+1 901 234 5678"]
},
...