-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CSV Import function #41
Comments
Yes! That's definitely something I want to do. Do you have any examples of what you want to import? No need for the actual data of course, just the headers and if possible some anonymized data. I've been thinking about how to implement this, would be nice to know how this data is usually presented. |
I'd really like to see this feature too! Here's a (sanitized) example of the export my bank provides when I ask for a csv.
|
This would be a great feature and is a must have, for me personally, since I'm not going to add all the transactions manually each month.
|
Work has officially started on this. More contributions, via code or your csv file are always welcome. Due to my job, it will be slow on weekdays, but hopefully I can pick it up on weekends. Currently the plan is: A one-size-fits-all solution seems impossible, so I'm taking a page out of of FireflyIII and developing customizable profiles you can configure according to your own CSV; a way to share these configurations, and maybe add them as presets for everyone to use, is also planned. For an idea of how this might work, take a look at the Rules section on the app, but instead of actions you will add headers and how they should map to WYGIWYH. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This are the csv headers exported by the default export of firefly (though it's possible to export more stuff by using the command line)
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Version 0.7.0 brings the beta version of Import and a bunch of other changes. Please check the release notes for what you need to do to upgrade and use this function: https://github.com/eitchtee/WYGIWYH/releases/tag/0.7.0 and https://github.com/eitchtee/WYGIWYH/wiki/Import for documentation (could be improved) Unfortunately this was a more complex task than I predicted, which led to a less interactive interface. Let me know what you think, folks. Feedback is always welcome. |
@eitchtee I'm testing the import function now, and I'm running into an issue. Instead of using one field for transaction amounts, my bank lists the amount as either "Amount Debit" or "Amount Credit". I figure I can use the current import scheme by doing this:
The problem is that when I try to create the import profile, it throws this error:
I've tried adding a comma as a separator, removing the space, both at the same time... It doesn't matter, I still get the same error. What is the proper formatting for listing the fields to merge? |
@crazybob1215 you have to use a list: - type: merge
fields:
- "Amount Debit"
- "Amount Credit"
separator: "" or - type: merge
fields: ["Amount Debit", "Amount Credit"]
separator: "" This is poorly documented on the wiki, I will update it. Let me know how it goes. |
@crazybob1215 it should look something like this in the end: settings:
file_type: csv
delimiter: ","
encoding: utf-8
skip_lines: 2
importing: transactions
trigger_transaction_rules: true
skip_errors: true
mapping:
account:
target: account
default: <YOUR ACCOUNT NAME>
type: name
date:
target: date
source: Date
format: "%m/%d/%Y"
amount:
target: amount
transformations:
- type: merge
fields: ["Amount Debit", "Amount Credit"]
separator: ""
description:
target: description
source: Description
type:
target: type
detection_method: sign
transformations:
- type: merge
fields: ["Amount Debit", "Amount Credit"]
separator: ""
notes:
target: notes
source: Memo
internal_id:
target: internal_id
source: Transaction Number
is_paid:
target: is_paid
detection_method: always_paid
deduplication:
- type: compare
fields:
- internal_id
match_type: strict |
Perfect, that cleared the error. I briefly ran into a permissions issue for the temp folder, but I'm past that now. I'm now seeing an error:
In the export from my bank, the account name is only listed once in the header, not on each line. I thought I had this covered by not setting a "source" for the account mapping. Here's what my full import profile looks like, and an example line from the csv:
|
@crazybob1215 your YAML looks pretty clean to me. You're right on you assumption, if no source is provided, it will default to default, if there isn't a default, it will be ignored. The error you mentioned happens when an account with the provided name or id can't be found, are you sure "BANK - Checking" (or the original value you're using) exists on your instance? Try quoting it just in case. Also you might want to change you type:
target: type
detection_method: sign
transformations:
- type: merge
fields: ["Amount Debit", "Amount Credit"]
separator: "" Currently you can't source a mapped value, just CSV headers. |
Ah, I thought I was targeting the account name correctly, but it is actually just "Checking" and not "BANK - Checking". As for the type mapping in your example, shouldn't the target be Now that it's successfully imported, I'm seeing two new errors.
|
Glad it worked.
You need to have two different mappings: amount:
target: amount
transformations:
- type: merge
fields: ["Amount Debit", "Amount Credit"]
separator: "" and type:
target: type
detection_method: sign
transformations:
- type: merge
fields: ["Amount Debit", "Amount Credit"]
separator: "" The first represents the transaction amount, internally WYGIWYH stores all amounts as positive values. The second, represents the type of the transaction, if it's Income or Expense. In the YAML you shared, My suggestion is to have both This definitely could be improved.
What we use for caching database queries is not playing nice with our task scheduler, I'm aware and looking for a fix, you can click the Yellow Bust icon on the navbar and select |
Also, if you enabled SOFT_DELETE, you might want to go to Management > Django Admin > Transactions and Hard Delete the transactions you imported so you can re-import them with the correct type. Select them all and choose the action shown below: If you didn't enable it, just deleting the wrong transactions should be enough to re-import. |
Adding both the |
No problem at all @crazybob1215 , this actually gave me some ideas on how to improve the config, stay tuned. |
@crazybob1215 you might want to upgrade to 0.8.0 and use a single container setup, make sure to read the release notes to know more about it. It should fix the caching problem. |
@eitchtee Upgraded to 0.8.0. Tried a couple imports and that seems to be working fine, also the caching seems to be working as well. I noticed that it is remembering my |
Seems a lot of manual setup, I thought just drop csv and we are good to go. This app seems like have all the feature I need, just need to play around to know it better, really appreciate all the things u do mate, thanks. |
@lucius100 unfortunately CSVs are universal, but not standardized, so there's some complexity that comes with that. We do have a presets feature to try to get away with some of these complexities, but it's lacking on presets right now, hopefully the community can pick up on it and share the configuration for their banks and apps. If you need help with your YAML config you can open an issue, just share how your data is presented and I will be happy to help. Hope you can try it out and like it. |
Hi, I love the project but it would be very useful it there would be an import (and, in the future export) function, either from csv or excel. This could be useful both for accounts, currencies etc. and for transactions
The text was updated successfully, but these errors were encountered: