# T212 Contract Note Email Importer

**URL:** <https://community.trading212.com/t/t212-contract-note-email-importer/15954>\
**Category:** 💬 Trading 212 chat\
**Created:** [August 12, 2020, 6:41pm UTC](https://community.trading212.com/t/t212-contract-note-email-importer/15954 "2020-08-12T18:41:20Z")\
**Posts on this page:** 17\
**Page:** 2

<div class="post-metadata">

**Author:** ![Blakwall](https://avatars.discourse-cdn.com/v4/letter/b/7bcc69/32.png) [@Blakwall](https://community.trading212.com/u/Blakwall)\
**Post date:** [December 31, 2020, 7:29pm UTC](https://community.trading212.com/t/t212-contract-note-email-importer/15954/21 "2020-12-31T19:29:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![kali](https://avatars.discourse-cdn.com/v4/letter/k/a88e57/32.png) [@kali](https://community.trading212.com/u/kali)\
**Post date:** [December 31, 2020, 8:04pm UTC](https://community.trading212.com/t/t212-contract-note-email-importer/15954/22 "2020-12-31T20:04:09Z")

</div>

> [@kali](#):
>
> ```auto
> // replace c1 with the sheet name you want to import into
> var sheet1 = currDocument.getSheetByName('c1');
> 
> ```

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

---

<div class="post-metadata">

**Author:** ![Blakwall](https://avatars.discourse-cdn.com/v4/letter/b/7bcc69/32.png) [@Blakwall](https://community.trading212.com/u/Blakwall)\
**Post date:** [January 1, 2021, 1:09am UTC](https://community.trading212.com/t/t212-contract-note-email-importer/15954/23 "2021-01-01T01:09:33Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![vvsvin](https://dub1.discourse-cdn.com/flex013/user_avatar/community.trading212.com/vvsvin/32/5591_2.png) [@vvsvin](https://community.trading212.com/u/vvsvin)\
**Post date:** [January 8, 2021, 12:25am UTC](https://community.trading212.com/t/t212-contract-note-email-importer/15954/24 "2021-01-08T00:25:58Z")

</div>

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

> [@Exportable Data](https://community.trading212.com/t/exportable-data/704/103):
>
> We just released an update of the iOS app which now includes the export feature. Android update will come tomorrow. Web - next week. We will post an official announcement and a quick guide on how to use the export feature as soon as Android users can see it too.

Transaction and order history can also be exported to csv.

---

<div class="post-metadata">

**Author:** ![Sunyu](https://dub1.discourse-cdn.com/flex013/user_avatar/community.trading212.com/sunyu/32/5295_2.png) [@Sunyu](https://community.trading212.com/u/Sunyu)\
**Post date:** [January 9, 2021, 6:11am UTC](https://community.trading212.com/t/t212-contract-note-email-importer/15954/25 "2021-01-09T06:11:17Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![nickspacemonkey](https://avatars.discourse-cdn.com/v4/letter/n/eb8c5e/32.png) [@nickspacemonkey](https://community.trading212.com/u/nickspacemonkey)\
**Post date:** [January 9, 2021, 11:50am UTC](https://community.trading212.com/t/t212-contract-note-email-importer/15954/26 "2021-01-09T11:50:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mukunthl](https://avatars.discourse-cdn.com/v4/letter/m/96bed5/32.png) [@mukunthl](https://community.trading212.com/u/mukunthl)\
**Post date:** [January 10, 2021, 6:31am UTC](https://community.trading212.com/t/t212-contract-note-email-importer/15954/27 "2021-01-10T06:31:44Z")

</div>

@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 ?

---

<div class="post-metadata">

**Author:** ![nickspacemonkey](https://avatars.discourse-cdn.com/v4/letter/n/eb8c5e/32.png) [@nickspacemonkey](https://community.trading212.com/u/nickspacemonkey)\
**Post date:** [January 10, 2021, 7:18pm UTC](https://community.trading212.com/t/t212-contract-note-email-importer/15954/28 "2021-01-10T19:18:08Z")

</div>

Set the currency as GBX ![image](https://europe1.discourse-cdn.com/flex013/uploads/trading212/original/2X/5/55e7c249a5695b04e4193e23fae374d097ab520e.png)

---

<div class="post-metadata">

**Author:** ![mukunthl](https://avatars.discourse-cdn.com/v4/letter/m/96bed5/32.png) [@mukunthl](https://community.trading212.com/u/mukunthl)\
**Post date:** [January 10, 2021, 8:18pm UTC](https://community.trading212.com/t/t212-contract-note-email-importer/15954/29 "2021-01-10T20:18:21Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![Sunyu](https://dub1.discourse-cdn.com/flex013/user_avatar/community.trading212.com/sunyu/32/5295_2.png) [@Sunyu](https://community.trading212.com/u/Sunyu)\
**Post date:** [January 12, 2021, 12:47am UTC](https://community.trading212.com/t/t212-contract-note-email-importer/15954/30 "2021-01-12T00:47:30Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![calvessec](https://avatars.discourse-cdn.com/v4/letter/c/8797f3/32.png) [@calvessec](https://community.trading212.com/u/calvessec)\
**Post date:** [February 8, 2021, 3:09pm UTC](https://community.trading212.com/t/t212-contract-note-email-importer/15954/31 "2021-02-08T15:09:21Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![EquityInvestor](https://avatars.discourse-cdn.com/v4/letter/e/8491ac/32.png) [@EquityInvestor](https://community.trading212.com/u/EquityInvestor)\
**Post date:** [February 8, 2021, 5:07pm UTC](https://community.trading212.com/t/t212-contract-note-email-importer/15954/32 "2021-02-08T17:07:25Z")

</div>

> [@calvessec](#):
>
> 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:

> [@Google Sheets Portfolio Tracker](https://community.trading212.com/t/google-sheets-portfolio-tracker/38009):
>
> Afternoon all, Thought I would share a thread on this. I have built a new portfolio tracker using the exportable data from the 212 app in Google Sheets, however I am still tweaking some of the setup. \*\*\* Edit - current version \*\*\* \*\*\* / Edit \*\*\* High level, this currently works like the following 0. Setup - Basic setup parameters, mapping of 212 export tickers to GoogleFinance ticker codes, and the base currency of your portfolio to report in. 1. 212 Trade Export 2. 212 Holdings - a ta…

---

<div class="post-metadata">

**Author:** ![Domenico](https://avatars.discourse-cdn.com/v4/letter/d/8e7dd6/32.png) [@Domenico](https://community.trading212.com/u/Domenico)\
**Post date:** [February 28, 2022, 6:54pm UTC](https://community.trading212.com/t/t212-contract-note-email-importer/15954/33 "2022-02-28T18:54:14Z")

</div>

Hello!  
Can you explain this procedure in detail, because I am trying in various ways to replicate it but I always get errors?  
Importing Trading212 csv files into Portfolio Perfomance is becoming a trauma for me!  
When I try to use the json file I get a blank error message and then I try to bind the columns manually. Then in the next screen all the operations are not imported.  
Thank you!

---

<div class="post-metadata">

**Author:** ![Domenico](https://avatars.discourse-cdn.com/v4/letter/d/8e7dd6/32.png) [@Domenico](https://community.trading212.com/u/Domenico)\
**Post date:** [February 28, 2022, 6:55pm UTC](https://community.trading212.com/t/t212-contract-note-email-importer/15954/34 "2022-02-28T18:55:33Z")

</div>

Can you explain to me how this file you created also works?  
Where should I replicate it? How do i use it?  
Thank you!

---

<div class="post-metadata">

**Author:** ![issalem](https://dub1.discourse-cdn.com/flex013/user_avatar/community.trading212.com/issalem/32/19554_2.png) [@issalem](https://community.trading212.com/u/issalem)\
**Post date:** [April 20, 2022, 9:27am UTC](https://community.trading212.com/t/t212-contract-note-email-importer/15954/35 "2022-04-20T09:27:59Z")

</div>

That’s awesome man 🙂

---

<div class="post-metadata">

**Author:** ![issalem](https://dub1.discourse-cdn.com/flex013/user_avatar/community.trading212.com/issalem/32/19554_2.png) [@issalem](https://community.trading212.com/u/issalem)\
**Post date:** [April 21, 2022, 2:00am UTC](https://community.trading212.com/t/t212-contract-note-email-importer/15954/36 "2022-04-21T02:00:15Z")

</div>

Thanks again for this great work @kali  
I have done some refactoring to the code and uploaded it to github for versioning

> <https://gist.github.com/IslamWahid/17dba39f9fc1134589d353a0446d1378>

please have a look and let me know what do you think?

---

<div class="post-metadata">

**Author:** ![issalem](https://dub1.discourse-cdn.com/flex013/user_avatar/community.trading212.com/issalem/32/19554_2.png) [@issalem](https://community.trading212.com/u/issalem)\
**Post date:** [April 21, 2022, 9:34am UTC](https://community.trading212.com/t/t212-contract-note-email-importer/15954/37 "2022-04-21T09:34:58Z")

</div>

but this you have to do manually.  
am interested to know if anyone managed to find a similar automated way to grab the CSV exports

[Previous page](https://community.trading212.com/t/t212-contract-note-email-importer/15954.md?page=1)
