Custom file parsers allow you to parse any file format by giving you control of the parsing logic. Dromo natively supports common CSV and Excel formats, but with custom file parsers you can enable your users to import PDF, XML, HTML, or any other file type when you implement the file parsing.
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.
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.
Custom File Parsing Example
In this example we’re parsing a fixed width file with stock prices. Each stock symbol is 4 characters and the price is the following 6 characters.