CSV / Excel
Comma-separated and Excel files are the most common file-based exchange formats. The framework reads both through the same reader interface, so one processing class can support both — the format is just a parameter on the Inbound message type.
Reader classes (in the DEVCommon model): DEVFileReaderBase, DEVFileReaderCSV, DEVFileReaderExcel (Excel reading is based on the bundled EPPlus library).
Reading is column-name based:
while (fileReader.readNextRow())
{
staging.MainAccount = fileReader.getStringByName('MainAccount');
staging.Amount = fileReader.getRealByName('Amount');
staging.insert();
}
Sample: ledger journal import
Class DEVIntegTutorialImportLedgerJournal imports a journal file, writes lines to staging, creates the journal via LedgerJournalEngine (so the result matches manual entry, including financial dimensions), and optionally posts it. The Post journal operation parameter can be switched off to inspect created journals during testing.
Tutorials:
- How to read Excel and CSV files using X++ — the reader classes in isolation.
- File-based integration for ledger journals — the complete integration with error handling.
- Performance: one million journal lines — parallel processing at scale.