Harvest export invoices.

If you use Harvest and need to export your invoices every time you need to file your taxes, you know the time it takes to select only the invoices you need.

To speed things up a little i looked at some cli scripts to help me.

First you need to install xquartx and pdfgrep. I install these packages with brew.

If these packages are installed go to the folder where all your invoices al stored.

  1. Move all invoices made from 01-03 into the folder 2015-Q1, make sure you created the folder first.
  2.  mkdir 2015-Q1

    for i in `pdfgrep -H  "Factuurdatum[ ]*[0-9]{2}/(01|02|03)/2015" *.pdf  | cut -d: -f1`; do mv $i 2015-Q1/; done

  3. Now we will change the default harvest name into $invoice-number.pdf
  4.  IFS=":"

    pdfgrep -H "Factuurnummer" *.pdf | sed -E "s/Factuurnummer[ ]{0,}//g" | while read pdf id ; do mv $pdf $id.pdf; done

  5.  Merge all pdfs’s
  6.  pdfunite 2015-*.pdf Q1.pdf

Posted by Bram