Socket
Socket
Sign inDemoInstall

bank-csv-importer

Package Overview
Dependencies
1
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    bank-csv-importer

CSV parser for bank statements


Version published
Weekly downloads
1
decreased by-66.67%
Maintainers
1
Install size
235 kB
Created
Weekly downloads
 

Readme

Source

The goal of this project is to be able to import any exported CSV (comma or semi colon separated) data from any bank account into a standard format, with everything such as CSV separator and column headings auto-detected. It's a work in progress. Please try it, and if some CSV file doesn't work for you, let me know.

Example

const bankImport = require("bank-csv-importer");

let result = bankImport(csvText); // May throw an error if input text is malformed
console.log(result);

After importing a CSV file, the result is:

{
	header, // The header row, if one was present and it was autodetected. null if not present.
	records : [], // records, split by separator and with header line removed
	typedRecords : [], // same as above but with some fields converted to Date or Number where possible
	numColumns,
	// For each column, whether all the typedRecords in that column are of the same type
	// Will be null if there are mixed types
	entireColumnTypes : ["String", "Number", "Date", null],
	headerGuesses : { // if any of these could not be guessed it will be null
		date : 0,
		amount : 1,
		balance : 2,
		description : 3
	}
}

Also some parse* functions are exported, which can be useful if you don't want to rely on typedRecords.

const {parseNumber, parseDate} = require("bank-csv-importer");

// Return null if could not be parsed
// parseDate uses "any-date-parser" and will greedily parse a lot of things as dates, so it's best to use parseNumber first,
// and if that fails, try parseDate.
console.log(parseNumber("1.123"));
console.log(parseDate("1/1/2021"));

Keywords

FAQs

Last updated on 19 Jan 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc