For a PDF importing example, see our guide on importing a PDF using the PDFTables API.
At a high level, custom parsers are a function you define which is called with the file contents and returns the parsed file as arrays of strings. You define which file extensions your parser should be used for, and if a user uploads a matching file, your file parsing function will be called instead of Dromo’s native file parsers. Custom parsers are invoked immediately when the user selects a file. Additionally, if a user goes to the Data Review step and then backtracks to a previous step, the file is re-parsed, so the custom parser will be called again to get a fresh, unedited copy of the file data. Custom parser functions receive two arguments, the file buffer and the filename.
buffer
ArrayBuffer
An ArrayBuffer containing the raw binary content of the uploaded file
fileName
string
The filename of the file selected by the user
File parsers must return a 2-dimensional array of strings. File parsers may return the value async, wrapped in a promise.
data
string[][]
Parsed data to be imported. The data must be an array with a length of at least 1, with each row being an array of strings. Each row must be the same length.