hjhart / ynab-amazon-importer

Other
28 stars 1 forks source link

Synopsis

This project should allow a user to export orders successfully from Amazon, and into the new YNAB (https://app.youneedabudget.com). It does it by downloading a couple of order exports from amazon, parsing the data, and spitting out a CSV which can be dragged into the you need a budget interface.

Code Example

Output a file to STDOUT:

./bin/ynab_transactions amazon_orders_and_shipments.csv amazon_items.csv

Output a file to a csv file

./bin/ynab_transactions amazon_orders_and_shipments.csv amazon_items.csv > amazon_transactions.csv

Motivation

I spend a lot of money on Amazon. I spend even more time importing my transactions into YNAB.

Manually going through my order history, clicking on each individual invoice (to determine which transactions map to a specific shipment), and THEN categorizing is expensive.

Hopefully this project eventually makes most of the busy work go away.

Installation

git clone https://github.com/hjhart/ynab-amazon-importer.git
cd ynab-amazon-importer
bundle install

How to use

Go here: https://www.amazon.com/gp/b2b/reports

Export two different CSVs, with Report Type set to 'Items' and one for 'Orders and shipments'.

"Order Report Histroy Screenshot"

Once they fully export (takes a while) you'll use both of these as inputs for the ruby script.

./bin/ynab_transactions amazon_orders_and_shipments.csv amazon_items.csv > amazon_transactions.csv

Now, drag navigate to the new YNAB, click on the credit card account that you use on amazon, and the amazon_orders.csv file anywhere in the browser. It should then show an import message with all of your transactions.

Assumptions:

You use one credit card for Amazon. We want to generate one CSV from all your amazon orders from one credit card right now. If an item doesn't have a shipment date, do not import the transaction. If an item doesn't have a tracking number, do not import the transaction.

Todo:

• Sometimes the date charged on amazon is not the day that the CC company charges it. • When there are multiple items in a fulfillment, divvy up the tax and shipping costs amongst it proportionately. • Support split transactions when a single shipment has multiple items. • If "release date" in the items CSV is in the future, schedule a transaction. • Support multiple credit cards. • Very complicated case: This order: 107-1647786-1817828 Paired with spec/fixtures/amazon_items_do_not_add_up_to_fulfillment_total.csv and spec/fixtures/amazon_orders_and_shipments_do_not_add_up.csv • Sometimes multiple fulfillments are only one charge. See: order: 106-4656789-9498659

Helpful URLS: https://www.amazon.com/gp/your-account/order-details/ref=oh_aui_or_o08_?ie=UTF8&orderID=#{your_order_id_here} https://www.amazon.com/gp/css/summary/print.html/ref=oh_aui_pi_o06_?ie=UTF8&orderID=#{your_order_id_here}

Tests

git clone https://github.com/hjhart/ynab-amazon-importer.git
cd ynab-amazon-importer
bundle install
bundle exec rspec

Contributors

James Hart Your name here!!!

License

MIT

Special Thanks

YNAB CSV generator

Those on /r/ynab who responded to my initial post.