Re: "Golang" csv file Importer

16 views
Skip to first unread message

fin

unread,
Jan 22, 2023, 12:36:29 PM1/22/23
to bean...@googlegroups.com
Paul Marriott wrote:
...
> I recently switched to "go" (golang) for a project and found it to be a
> great choice. I created a simple application to preprocess csv files using
> google sheets, which I thought I'd share with the group. Here's the link to
> the repository on Github: https://github.com/PaulsTek/csv2bean
>
> It's been helpful for me in dealing with importers and I hope it can help
> someone else too. Let me know if you have any questions or feedback.

i haven't had a chance to work with it yet, but i would
consider the requirement to reprocess a file via a spread-
sheet to remove empty fields or to put in zeroes to be a
non-starter. simply put, those are things that a program
should be able to detect in a csv file and shouldn't
require anyone to manually do that sort of work.

this morning i just figured out why my other importer
wasn't working so i don't need something else at the moment
but if you fix the above things i'd give it a whirl for my
next import project.


fin

Paul Marriott

unread,
Jan 22, 2023, 1:00:42 PM1/22/23
to Beancount
I am adding more to the config file to enable direct import of csv files, but there are so may different csv download formats;  every financial institution seems to have their own version!  I'll deal with the most common options first such as lack of a header file (eg WellsFargo bank downloads) and differing column header names.  The Python importers I have seen all work along these lines, but I am just no where near as proficient in Python programming as I am with cpp and go.
Paul

fin

unread,
Jan 22, 2023, 1:25:51 PM1/22/23
to bean...@googlegroups.com
Paul Marriott wrote:
...
> I am adding more to the config file to enable direct import of csv files,
> but there are so may different csv download formats; every financial
> institution seems to have their own version! I'll deal with the most
> common options first such as lack of a header file (eg WellsFargo bank
> downloads) and differing column header names. The Python importers I have
> seen all work along these lines, but I am just no where near as proficient
> in Python programming as I am with cpp and go.

it should have nothing to do with python.

a default for no fields specified could be to make all strings
text fields and if any are null you could make them the empty string.

if you do have a header line then for a text field that and has no
value you can default it to an empty string and if the field is a
numerical value you can default it to zero.

nothing else should be required for the simple version you stated
before.

that all said...

in many fields of csv files i see there are no values supplied
and which fields are empty varies based upon transaction type.

it might actually be better overall to only import the fields
needed for a specific transaction type (which would avoid a lot
of what i've said above but add more logic to the importer
transaction builders themselves).


fin

Reply all
Reply to author
Forward
0 new messages