TXF 2 CSV

From EggeWiki
Revision as of 13:20, 20 February 2011 by Egge (talk | contribs) (Created page with 'I used to use Scottrade as my broker and they provide capital gains information in an exportable TXF format file. I use TaxAct Online to process my tax return. TaxAct can't be …')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

I used to use Scottrade as my broker and they provide capital gains information in an exportable TXF format file. I use TaxAct Online to process my tax return. TaxAct can't be bothered to create a TXF import, however, they do provide a CSV import. I figured it would be fairly trivial to transform the data from one format to another. The following is a ruby script which does just that.

  1. !/usr/bin/env ruby

in_header=true idx=0 description=nil date_end=nil price_end=nil date_start=nil price_start=nil quantity=nil wash_sale= withholding= ARGF.each do |line|

 line.chomp!
 line.strip!
 line.gsub!(',', )
 if in_header then
   if line == '^' then
     in_header = false
   end
   next
 end
 idx += 1
 case idx
 when 1..4
   next
 when 5
   if line =~ /P([0-9]+[.][0-9]{4}) of (.*)/ then
     quantity = $1
     description = $2
   else
     raise "error parsing #{line}"
   end
 when 6
   if line =~ /D(.*)/ then
     date_start = $1
   else
     raise
   end
 when 7
   if line =~ /D(.*)/ then
     date_end = $1
   else
     raise
   end
 when 8
   if line =~ /[$](.*)/ then
     price_start = $1
   else
     raise
   end
 when 9
   if line =~ /[$](.*)/ then
     price_end = $1
   else
     raise
   end
 when 10
   if line == '^' then
     print "\"#{description}\",#{date_end},#{price_end},#{date_start},#{price_start},#{wash_sale},#{withholding},#{quantity},\r\n"
     idx = 0
   end
 else
   raise
 end

end


Unfortunately, the TaxAct import only works with Internet Explorer. This is something I found out via trial and error. I noticed that it would reject my file so fast that it could not have possibly uploaded it to TaxAct. Their email support was completely worthless, only sending me to a link to the one and only help page.

I logged onto a Windows machine and was able to upload the file without issue using IE 7. TaxAct then allows you to select which columns match which header. If you provide a header line it will auto select all matching headers. This is nice, but on the next screen having a header line prevents you from using the 'Import All' feature. The whole reason I went through the import process is because I have hundreds of records to input. I deleted the header, and the was able to import all the data.