how to import and parse a csv/textfile

As a beginner I hope to get a general direction in which to look further: I receive textfiles with three different sets of information in the form of: so line 1 and 2 describe two fields (name and date), line 3 – 5 have six fields and line 6 and further have eleven fields The first line of each ‘chapter’ is the header. How should I go about importing this in Mendix? What steps should I take? I want to end up in something like: I would value your input as I'm not familiar with all of Mendix’ possibilities and strategies,   regards,   Bert   
3 answers


Use your own java action. If the file follows a pattern you can implement that pretty easily with counters/modulus.

If it is a free form file, get basic csv parser and IMendixObject population going for the different sections, just modify the files for testing. Then modify your code it to test and detect your sections Thereafter the section detection and parsing/population code can be combined and tested again.

Alternatively write a parser that populates a domain representation of the file (file 1-* row 1-* field) and parse the rest in mendix then drop your abstract representation

This is interesting because the aggregate nature of the data contained in the csv



You can check out the microflow that generated this here


Hi Bert,

Have you tried adding and using the CSV Import module from the appstore? It lets you import and process csv files. You would probably have to cut your file into 3 files: every file with 1 header row and subsequent rows that follow these colums.

Good luck!


Bit off topic: Also have a look at the automated Excel file import now available in the sprintr. Button “Create app” and “Start from Data”