reubano / csv2ofx

A Python library and command line tool for converting csv to ofx and qif files
MIT License
199 stars 113 forks source link

Get Schwab account_id from CSV first line #117

Closed tstabrawa closed 8 months ago

tstabrawa commented 8 months ago

This PR addresses a TODO line item for the Schwab mapping, namely:

# Note: Ideally, we could get account_id from the first line of the CSV.

This works by providing the CSV header via the custom_header field (implemented in #116), despite the header being present in the CSV. With the header specified in this way, we can parse lines of the CSV file that come before the included header (such as the one that has the account ID). Additionally, we include a sanity test when parsing the actual header line of the CSV file, and confirm that the field names in the CSV file match those in custom_header.

Confirmed all tests are passing (by manually running ./tests/test.py -- for some reason, manage lint hangs for me and manage test throws a AttributeError: module 'collections' has no attribute 'Callable' error for me now).

Uses the custom_header feature implemented in #116 and adds tests for this feature.