beancount / beancount

Beancount: Double-Entry Accounting from Text Files.
http://beancount.github.io/
GNU General Public License v2.0
3.71k stars 303 forks source link

extract a dict importer to table importer fronm CSV.importer #546

Closed trim21 closed 4 years ago

trim21 commented 4 years ago

This could also help user to support HTML table or excel.

dnicolodi commented 4 years ago

The importers in the beancount codebase are mostly meant to be examples, not a complete framework to write importers. Having the flexibility to cover everyone needs would make them as complex as writing your own code. CSV is a sufficiently common format that a shared importer saves some coding in the most common cases, however, covering all possible quirks and extensions is outside its scope.

Writing an importer from tabular data is extremely easy: just iterate the rows and instantiate Transaction objects. It can be done in less than 10 lines of code. The code needed to obtain tabular data from HTML or Excel is going to be significantly longer than that. I would suggest you to write these importers from scratch. If you think that some utility functions may make writing these importers easier, we may look into adding them instead.

blais commented 4 years ago

I agree with Daniele. In fact, in v3 I'd like to move the CSV importer to its own repo, it was really intended to be just an example (but it works too well, so it has grown without enough tests).