Skip to main content
This section describes the state builder object of the importer.

constructor

Parameters: importerDefinition: Pick< ImporterDefinition, | 'sheets' | 'customFileLoaders' | 'customSuggestedMapper' | 'onDataColumnsMapped'> Description:
Defines the importer configuration. Checkout the Importer Props section for more information.

Methods

The order of the methods might be important. Please follow the order defined below. You don’t need to run all the methods though.

uploadFile

Parameters: file: File Required to call next steps: Yes Description:
Keep in mind that this is asynchronous function. Make sure to await the result of it.
The function simulates the upload of a file. It will parse the file and build the suggested mappings.

setEnterDataManually

Parameters: amountOfEmptyRowsToAdd?: number Required to call next steps: No Description:
This method will add empty rows to the current sheet and switch the mode to preview - this means that it will skip the mapping step and ignore uploaded file.

setMappings

Parameters: mappings: ColumnMapping[] Required to call next steps: No Description:
This method will set the mappings for the current sheet.

confirmMappings

Parameters: mappings: ColumnMapping[] Required to call next steps: Yes Description: Remember that this is asynchronous function. Make sure to await the result of it. Confirm the mappings for the current sheet. This will switch the mode to preview.

getState

Parameters: none Description:
Returns the built state. This should be the last method you call.

Example