T212 Contract Note Email Importer

Hi,

Is this working?
I’ve tried to run it but I’m getting an error:

TypeError: Cannot read property ‘split’ of undefined

isin

@ Code.gs:8

I get the same error. Any help from you guys would be appreciated.

@nickspacemonkey can I ask what software is that and how I can create one for myself? Thanks

This is in fact still working, and I use it daily. The error message indicates your script was not able read an email (it is failing to split the email body on lines)

Did you make the changes mentioned in the comments like pointing to the correct labels in gmail?

1 Like

Yes, I did. Actually it worked after a few tries. Dunno why. Thanks for the script.

One more question, on your latest script iteration you’re converting the values to GBP, right? And removed the column headers?

It’s portfolio performance: https://www.portfolio-performance.info/en/

I didn’t really do anything special, just followed @kali’s guide a few posts up:

1 Like

Hi,

I have made multiple failed attempts at trying to get the code to work. I have tried both the original script and the altered version posted on 31/08. When I save the script in the editor and hard refresh the google sheet, there is no option to import the script. As I said, I have followed the steps outlined multiple times and have failed on each attempt. Any help is greatly appreciated.

image

without using the menu item, in the script editor you can select the function you want and hit run. Do you see any errors in the when doing so?

TypeError: Cannot read property ‘appendRow’ of null (line 156, file “Code”)

did you forget to do this?
read the comments in the code there are things that you need to change

Solved! My apologies, I had understood “replace c1 with the sheet name” as the document (or spreadsheet) name, not the individual sheet. Thanks for your help, Happy New Year!

Now the export to csv is available in iOS app.
Just tried it to export dividend data and able to export.

Transaction and order history can also be exported to csv.

Can’t make this work after some hours on it
My portfolio is EURO so I modified this is what happens

  • The value is wrong when exporting instead of euros is thousands of euros (what do you put in the columns of portfolio performance, I think the value and gross amount are wrong in the col for me or something)

The iOS and Android apps have export functionality now. Will come to desktoop soon I think.

@kali Hi. Thank you for your elaborate post. I have been trying to use PP with CSV imported from T212 contracts as you had explained. It works well for most part. Only issue I find is when trying to get historical quotes from yahoo for stocks that have their prices mentioned in GBX and USD. PP considers the prices to be in GBP and messes up my entire portfolio. Any workaround for this ?

Set the currency as GBX image

@nickspacemonkey Thanks for your reply. I have imported the transactions from T212 contract CSV. So I am not able to change the currency now. I get a similar message as seen in your Screenshot saying that currency can’t be changed as transaction already recorded.

It would be nice to have a video on how you do it, even without sound it’s really interesting because I can make an import but the values are all wrong…

I use Hotmail instead of Gmail even though I have a Gmail account. I created a rule to automatically forward the contract notes to my Gmail but the script doesn’t seem to work. I guess the problem is that it’s checking only the most recent messages in the conversation (ie. an empty message from my Hotmail) instead of the original email from Trading212.

Example, my forwarded message contains:

  • Email from Hotmail to Gmail
  • Email from Trading212 to Hotmail

Only the first one is being processed. The code checks all messages in the threads with the specified label so I thought it would work. Any thoughts?

It might be easier to use @Dougal1984’s Google Sheets Portfolio Tracker.
Have a look at the thread to see if it is of use: