{"id":25688895,"url":"https://github.com/eshaffer321/bank2sheets","last_synced_at":"2025-04-24T01:41:40.512Z","repository":{"id":40742975,"uuid":"196038602","full_name":"eshaffer321/Bank2Sheets","owner":"eshaffer321","description":"Node.js server with the purpose of categorizing and inserting bank transactions into a Google Sheet via Sheets API.","archived":false,"fork":false,"pushed_at":"2023-01-23T23:39:00.000Z","size":2338,"stargazers_count":8,"open_issues_count":24,"forks_count":4,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-30T05:41:14.271Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eshaffer321.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-09T15:44:02.000Z","updated_at":"2024-12-02T12:27:42.000Z","dependencies_parsed_at":"2023-02-13T04:46:08.053Z","dependency_job_id":null,"html_url":"https://github.com/eshaffer321/Bank2Sheets","commit_stats":null,"previous_names":["eshaffer321/bank2sheets"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eshaffer321%2FBank2Sheets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eshaffer321%2FBank2Sheets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eshaffer321%2FBank2Sheets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eshaffer321%2FBank2Sheets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eshaffer321","download_url":"https://codeload.github.com/eshaffer321/Bank2Sheets/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250545653,"owners_count":21448246,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-24T21:17:10.017Z","updated_at":"2025-04-24T01:41:40.495Z","avatar_url":"https://github.com/eshaffer321.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bank Of America to Google Spreadsheet - Web Server\n[![CircleCI](https://circleci.com/gh/eshaffer321/BankOfAmerica-2-GoogleSheet-API.svg?style=svg)](https://circleci.com/gh/eshaffer321/BankOfAmerica-2-GoogleSheet-API)\n[![Coverage Status](https://coveralls.io/repos/github/eshaffer321/boa-spreadsheet-api/badge.svg?branch=master)](https://coveralls.io/github/eshaffer321/boa-spreadsheet-api?branch=master)\n![Docker Pulls](https://img.shields.io/docker/pulls/erickshaffer/boa-spreadsheet-api.svg)\n\nBank transactions categorized automatically inserted into a [google sheet](https://docs.google.com/spreadsheets/d/14GYLeWTUBPFWYzXMAJJV4YPmwcsf6vabkQ0-CeHSqHQ/edit?usp=sharing).\n## About\nThe motivation behind this project is that my spouse and I have different bank accounts. I wanted to centralize our \nbank transactions into a single google sheet. However, I don't like spending time manually inserting\ntransactions into the sheet. So I created an automated way to centralize multiple bank accounts into one sheet.\n\n\nIn addition, I wanted to have the transactions be categorized. Bank of America has categorization but often times they \ndon't put transactions into categories that I want. For example, if I go to a winery that would fall under entertainment\nwhile Bank of America categorizes it as groceries. To solve that, this service allows custom rules be implemented to re-categorize transactions.\n\n\nThe transaction are screen scraped from a [python web scraper](https://github.com/eshaffer321/boa-web-scraper). \nThe gathered transactions are sent via RESTful calls to this service, which then re-categorizes and inserts them into a google spread sheet.\n\n## Getting Started\n\nStart the project by running:\n### Running locally\n```\nnpm install\n```\nYou will need a google service account with correct IAM policies for accesing google sheets api. The private key and email from the google provided `credentials.json` must be placed in the `.env` file. Additionally, the service account email must be granted access to the spreadsheet.\n\n### Running with Docker\nUse the following command to start a docker container with the latest image. Please make sure that all the following environment variables are set in your shell before running.\n```\nsudo docker run --name=boa-api -p 80:80 -d \\\n           -v ~/log:/app/log \\\n           --env PRIVATE_KEY=\"${PRIVATE_KEY}\" \\\n           --env SPREADSHEET_ID=\"${SPREADSHEET_ID}\" \\\n           --env SHEET_ID=\"${SHEET_ID}\" \\\n           --env CLIENT_EMAIL=\"${CLIENT_EMAIL}\" \\\n           --env MAILGUN_API_KEY=\"${MAILGUN_API_KEY}\" \\\n           --env TO_EMAIL=\"${TO_EMAIL}\" \\\n           --env MAILGUN_DOMAIN=\"${MAILGUN_DOMAIN}\" \\\n            erickshaffer/boa-spreadsheet-api:latest\n```\n\n## Environment Variables\nThese are the environment variables that must be set. If you would like to get email reports from mail gun,\nprovide the mailgun credentials.\n```\nSPREADSHEET_ID=\nSHEET_ID=\nPORT=\nNODE_ENV=\nCLIENT_EMAIL=\nPRIVATE_KEY=\nMAILGUN_API_KEY=\nMAILGUN_DOMAIN=\nTO_EMAIL=\n```\n## How it works\nThere are 2 important files that allow the service to correctly insert transcation into the sheet. \nThe first is [rules.json](https://github.com/eshaffer321/boa-spreadsheet-api/blob/master/static/rules.json).\nThis use regular expressions to match properties of a transaction, and re-categorize based on the item. Here is an example of a rule that would re-categorize an item that matched the pattern /VINEYARD/ to groceries. \n\n```\n{\n    \"expression\": \"VINEYARDS\",\n    \"properties_to_match\": [\n      \"merchantName\"\n    ],\n    \"updated_values\": {\n      \"category\": \"Entertainment\"\n    }\n  }\n```\n\nIt is possible to use values to recategorize transactions.\n```\n{\n    \"expression\": \"59.00\",\n    \"properties_to_match\": [\n      \"amount\"\n    ],\n    \"updated_values\": {\n      \"category\": \"Phones\"\n    }\n  },\n  ```\n  \nThe rules are evaluated sequentially. The last matching expression is the one that will be used on the transaction. \n\n\nThe second important file is [ranges.json](https://github.com/eshaffer321/boa-spreadsheet-api/blob/master/static/ranges.json). \nThis defines what the column numbers are for each of the category types. This maps a name to a column number. This column number is the left most column of the 3 merged cells. This is where you could change the column layout, and include new columns.\n\nThe ranges for which for which cells are pulled from the api are located in the class constructor. To adjust what ranges are used, make changes here.\n```\nexport class Balance {\n    constructor() {\n        this.range = 'A10:D15';\n    }\n}\n```\n\n# Testing\nTo run the test:\n```\nnpm test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feshaffer321%2Fbank2sheets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feshaffer321%2Fbank2sheets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feshaffer321%2Fbank2sheets/lists"}