Skip to content

Commit

Permalink
Merge branch 'master' of github.com:stant/mdcsvimporter2015
Browse files Browse the repository at this point in the history
# Conflicts:
#	.gitignore
  • Loading branch information
sreilly committed Apr 20, 2020
2 parents 105967b + 800ed39 commit bc3b14c
Show file tree
Hide file tree
Showing 25 changed files with 1,886 additions and 766 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
/build/
nbproject/private/private.xml
user.properties
83 changes: 82 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,90 @@
# mdcsvimporter2015
Moneydance plug-in to import transactions from CSV files. You can define, simply, on a screen, any number of 'Custom Readers' yourself, one for each Account file. You define the order and fields that will be imported into MD, like Date, Amount, Description, Category, etc... You can ignore fields, and specify that certain fields "Can Be Blank". You can test if a file parses properly, and have it find and list files to import that are tied by file name to a Custom Reader. You can do Regex parsing of csv files for tricky situations. And importantly, it will not import transactions that you previously imported, by doing matching. There is a How To doc you can download with an example of how to define your own custom readers.
Moneydance plug-in to import transactions from CSV files. You can define, simply, on a screen, any number of 'Custom Readers' yourself, one for each Account file.
- You define the order and fields that will be imported into MD, like Date, Amount, Description, Category, etc...
- You can ignore fields, and specify that certain fields "Can Be Blank" (otherwise the cannot be blank).
- You can test if a file parses properly,
- and have it find and list files to import that are tied by file name to a Custom Reader.
- You can do Regex parsing of csv files for tricky situations.
- And importantly, it will not import transactions that you previously imported, by doing matching.
- There is a How To doc you can download with an example of how to define your own custom readers.

Latest version: only from here - version right in Money Dance is: 15.7.7 at this time, so if you want the latest, get it from here.
Remove old version. Restart. Install via 'Add From File'.

The plug-in is still considered BETA, however, it works well for people who have tried it.

It is distributed under GNU LGPL. Among other things this means that it is free, but that the authors cannot take any responsibility for you using this code.

** Quick Usage:
This is a top down window process. I might look at getting rid of 'Date Format', but when I have time.
You have to define a reader first of all and tell it how to match filenames. An improvement I plan to make is to tell people if they do not have one and that they need to create one first.

* 1.) So, what I do is download a new trans list csv file from my bank (XYZ)
* 2.) in MD do, "Import File" (my extension)
* 3.) I have say 6 defined so I pick the "File Reader" for my bank (XYZ).
* 4.) I hit button "Find Import File(s) for this Reader."
It populates "Select Import File:" dropdown with my list of files that match my reader "filename matcher". It also gives the number of files that match. Hopefully 1. If not I pick the file I want to import.
* 5.) Hit "Preview Import" so it validates the importing transactions.
* 6.) "Process" button becomes enabled. Hit it to do the import.
- Done.

** How to Set Up 'Filename Matcher': (you match with a regex, regular expression, look that up)
`Here are some examples:`

`.*\.(csv|CSV) .* means match anything, then it has to end with a dot "\." and either csv or CSV`
`(this|that) matches "this" or "that"`

`download.*\.(csv|CSV) almost the same but it has to begin with "download" then anything, then .csv or .CSV`

`for VISA: `
`Transactions_\d+_\d+.csv matches Transactions_(1 or more numbers)_(1 or more numbers).csv`
`like: Transactions_20170325_214425.csv`

`for Discover: `
`(DFS-|Discover).*\.(csv|CSV) matches DFS- or Discover, then anything, then .csv or .CSV`
`like DFS-whatever.csv or Discover.1234.CSV`

** regex field parsing changed in v21 to hopefully give more flexibility. you need to use "named capture groups", as in:

value = what string you want to pull out for the field value.
rest = is left over line to parse next.

```java
"?(?<value>.*?)"?(?:[,]|\Z)(?<rest>(.*|\Z)) will handle basic csv parsing

"(?<value>.*?)"(?:[,]|\Z)(?<rest>(.*|\Z)) I had to do this to get amount within "123,456.78"

"?(?<value>.*?)"?(?:[,]|\Z) final list for "ignore rest"

(?:CHECK[ ](?<value>\d*)|(.{0,0}))(?<rest>.*) This actually adds an extra column.

it will parse
04/10/2018,CHECK 0001234,,"($530.46)","$123"
04/04/2018,Insurance,PREM,"($467.30)","$5"

into
04/10/2018,1234, , ,"($530.46)","$123"
04/04/2018, ,Insurance,PREM,"($467.30)","$5"


How it parses a whole line:

if you have this line:
01/14/2018,check 3000,My Store,$123.40,whatever

it will parse like this:
get value = 01/14/2018
rest = check 3000,My Store,$123.40,whatever

get value = check 3000
rest = My Store,$123.40,whatever

get value = My Store
rest = $123.40,whatever

get value = $123.40
rest = whatever

get value = whatever
rest =
```
2 changes: 1 addition & 1 deletion build/built-jar.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Thu, 26 Mar 2015 00:12:42 -0400
#Sun, 20 Mar 2016 22:38:40 -0400


F\:\\github\\mdcsvimporter2015=
Binary file modified dist/mdcsvimporter.mxt
Binary file not shown.
Binary file modified dist/mdcsvimporter.zip
Binary file not shown.
35 changes: 21 additions & 14 deletions nbproject/build-impl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ is divided into following sections:
<property file="${user.properties.file}"/>
<!-- The two properties below are usually overridden -->
<!-- by the active platform. Just a fallback. -->
<property name="default.javac.source" value="1.4"/>
<property name="default.javac.target" value="1.4"/>
<property name="default.javac.source" value="1.6"/>
<property name="default.javac.target" value="1.6"/>
</target>
<target depends="-pre-init,-init-private,-init-user" name="-init-project">
<property file="nbproject/configs/${config}.properties"/>
Expand Down Expand Up @@ -76,7 +76,7 @@ is divided into following sections:
<and>
<isset property="javac.profile"/>
<length length="0" string="${javac.profile}" when="greater"/>
<matches pattern="1\.[89](\..*)?" string="${javac.source}"/>
<matches pattern="((1\.[89])|9)(\..*)?" string="${javac.source}"/>
</and>
</condition>
<condition property="do.archive">
Expand Down Expand Up @@ -156,6 +156,7 @@ is divided into following sections:
<property name="application.args" value=""/>
<property name="source.encoding" value="${file.encoding}"/>
<property name="runtime.encoding" value="${source.encoding}"/>
<property name="manifest.encoding" value="${source.encoding}"/>
<condition property="javadoc.encoding.used" value="${javadoc.encoding}">
<and>
<isset property="javadoc.encoding"/>
Expand Down Expand Up @@ -191,7 +192,12 @@ is divided into following sections:
</not>
</and>
</condition>
<property name="javac.fork" value="${jdkBug6558476}"/>
<condition else="false" property="javac.fork">
<or>
<istrue value="${jdkBug6558476}"/>
<istrue value="${javac.external.vm}"/>
</or>
</condition>
<property name="jar.index" value="false"/>
<property name="jar.index.metainf" value="${jar.index}"/>
<property name="copylibs.rebase" value="true"/>
Expand All @@ -217,6 +223,7 @@ is divided into following sections:
<condition else="" property="testng.debug.mode" value="-mixed">
<istrue value="${junit+testng.available}"/>
</condition>
<property name="java.failonerror" value="true"/>
</target>
<target name="-post-init">
<!-- Empty placeholder for easier customization. -->
Expand Down Expand Up @@ -693,7 +700,7 @@ is divided into following sections:
<sequential>
<property environment="env"/>
<resolve name="profiler.current.path" value="${profiler.info.pathvar}"/>
<java classname="@{classname}" dir="${profiler.info.dir}" fork="true" jvm="${profiler.info.jvm}">
<java classname="@{classname}" dir="${profiler.info.dir}" failonerror="${java.failonerror}" fork="true" jvm="${profiler.info.jvm}">
<jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
<jvmarg value="${profiler.info.jvmargs.agent}"/>
<jvmarg line="${profiler.info.jvmargs}"/>
Expand Down Expand Up @@ -768,7 +775,7 @@ is divided into following sections:
<attribute default="${debug.classpath}" name="classpath"/>
<element name="customize" optional="true"/>
<sequential>
<java classname="@{classname}" dir="${work.dir}" fork="true">
<java classname="@{classname}" dir="${work.dir}" failonerror="${java.failonerror}" fork="true">
<jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
<jvmarg line="${debug-args-line}"/>
<jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
Expand All @@ -795,7 +802,7 @@ is divided into following sections:
<attribute default="jvm" name="jvm"/>
<element name="customize" optional="true"/>
<sequential>
<java classname="@{classname}" dir="${work.dir}" fork="true">
<java classname="@{classname}" dir="${work.dir}" failonerror="${java.failonerror}" fork="true">
<jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
<jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
<redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
Expand Down Expand Up @@ -834,7 +841,7 @@ is divided into following sections:
</chainedmapper>
</pathconvert>
<taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
<copylibs compress="${jar.compress}" excludeFromCopy="${copylibs.excludes}" index="${jar.index}" indexMetaInf="${jar.index.metainf}" jarfile="${dist.jar}" manifest="@{manifest}" rebase="${copylibs.rebase}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
<copylibs compress="${jar.compress}" excludeFromCopy="${copylibs.excludes}" index="${jar.index}" indexMetaInf="${jar.index.metainf}" jarfile="${dist.jar}" manifest="@{manifest}" manifestencoding="UTF-8" rebase="${copylibs.rebase}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
<fileset dir="${build.classes.dir}" excludes="${dist.archive.excludes}"/>
<manifest>
<attribute name="Class-Path" value="${jar.classpath}"/>
Expand All @@ -846,7 +853,7 @@ is divided into following sections:
</target>
<target name="-init-presetdef-jar">
<presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
<jar compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}">
<jar compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}" manifestencoding="UTF-8">
<j2seproject1:fileset dir="${build.classes.dir}" excludes="${dist.archive.excludes}"/>
</jar>
</presetdef>
Expand Down Expand Up @@ -969,23 +976,23 @@ is divided into following sections:
</target>
<target depends="init" if="do.archive+manifest.available" name="-do-jar-copy-manifest">
<tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/>
<copy file="${manifest.file}" tofile="${tmp.manifest.file}"/>
<copy encoding="${manifest.encoding}" file="${manifest.file}" outputencoding="UTF-8" tofile="${tmp.manifest.file}"/>
</target>
<target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+main.class.available" name="-do-jar-set-mainclass">
<manifest file="${tmp.manifest.file}" mode="update">
<manifest encoding="UTF-8" file="${tmp.manifest.file}" mode="update">
<attribute name="Main-Class" value="${main.class}"/>
</manifest>
</target>
<target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+profile.available" name="-do-jar-set-profile">
<manifest file="${tmp.manifest.file}" mode="update">
<manifest encoding="UTF-8" file="${tmp.manifest.file}" mode="update">
<attribute name="Profile" value="${javac.profile}"/>
</manifest>
</target>
<target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+splashscreen.available" name="-do-jar-set-splashscreen">
<basename file="${application.splash}" property="splashscreen.basename"/>
<mkdir dir="${build.classes.dir}/META-INF"/>
<copy failonerror="false" file="${application.splash}" todir="${build.classes.dir}/META-INF"/>
<manifest file="${tmp.manifest.file}" mode="update">
<manifest encoding="UTF-8" file="${tmp.manifest.file}" mode="update">
<attribute name="SplashScreen-Image" value="META-INF/${splashscreen.basename}"/>
</manifest>
</target>
Expand Down Expand Up @@ -1180,7 +1187,7 @@ is divided into following sections:
<target depends="-profile-check" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-test-with-main">
<fail unless="run.class">Must select one file in the IDE or set run.class</fail>
<startprofiler/>
<antcal target="run-test-with-main"/>
<antcall target="run-test-with-main"/>
</target>
<target depends="-profile-check,-profile-applet-pre72" if="profiler.configured" name="profile-applet" unless="profiler.info.jvmargs.agent">
<fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
Expand Down
4 changes: 2 additions & 2 deletions nbproject/genfiles.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ build.xml.stylesheet.CRC32=958a1d3e
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=277518bf
nbproject/build-impl.xml.script.CRC32=5d17cf3b
nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.75.2.48
nbproject/build-impl.xml.script.CRC32=0e6c8627
nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48
2 changes: 1 addition & 1 deletion nbproject/private/private.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ do.depend=false
do.jar=true
javac.debug=true
javadoc.preview=true
user.properties.file=C:\\Users\\stan\\AppData\\Roaming\\NetBeans\\8.0\\build.properties
user.properties.file=/ext/tmp/netbeans/.netbeans/8.2/build.properties
8 changes: 7 additions & 1 deletion nbproject/private/private.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group>
<file>file:/F:/github/mdcsvimporter2015/src/com/moneydance/modules/features/mdcsvimporter/Main.java</file>
<file>file:/F:/github/mdcsvimporter2015/src/com/moneydance/modules/features/mdcsvimporter/CustomReaderDialog.java</file>
<file>file:/F:/github/mdcsvimporter2015/src/com/moneydance/modules/features/mdcsvimporter/TransactionReader.java</file>
<file>file:/F:/github/mdcsvimporter2015/src/com/moneydance/modules/features/mdcsvimporter/PreviewImportWin.java</file>
<file>file:/F:/github/mdcsvimporter2015/src/com/moneydance/modules/features/mdcsvimporter/ImportDialog.java</file>
<file>file:/F:/github/mdcsvimporter2015/src/com/moneydance/modules/features/mdcsvimporter/CustomTableCellRenderer.java</file>
<file>file:/F:/github/mdcsvimporter2015/src/com/moneydance/modules/features/mdcsvimporter/formats/CustomReader.java</file>
<file>file:/F:/github/mdcsvimporter2015/src/com/moneydance/modules/features/mdcsvimporter/CustomReaderData.java</file>
<file>file:/F:/github/mdcsvimporter2015/src/com/moneydance/modules/features/mdcsvimporter/CSVReader.java</file>
<file>file:/F:/github/mdcsvimporter2015/src/com/moneydance/modules/features/mdcsvimporter/CSVData.java</file>
</group>
</open-files>
</project-private>
Loading

0 comments on commit bc3b14c

Please sign in to comment.