Importing TSP data to Google sheets

Discuss all general (i.e. non-personal) investing questions and issues, investing news, and theory.
Post Reply
Topic Author
donheff
Posts: 22
Joined: Thu Jan 25, 2018 1:19 pm

Importing TSP data to Google sheets

Post by donheff »

I have been using an ImportHtml function I read about in this thread to load TSP fund prices into a Google Spread sheet. For years the function worked fine pulling data from cells in a table at: https://www.tsp.gov/investmentfunds/sha ... tory.shtml. Unfortunately the function now fails, redirecting to a server that is not available.

I can find the page where the table data is dynamically displayed at: https://www.tsp.gov/InvestmentFunds/Fun ... index.html. But using my rudimentary skills to find where the supporting table is now located failed. Does anyone know where it is?

For Morningstar daily trailing returns for mutual funds, I use an ImportXML function and can always find the supporting table data using network>XHR in Chrome developer tools. I haven't been so lucky with the TSP site.
ishkadetto
Posts: 63
Joined: Thu May 24, 2018 2:49 pm
Location: California, USA

Re: Importing TSP data to Google sheets

Post by ishkadetto »

This works for me (note: column "7" is the G fund). Change that one number as needed for the column of the fund you need.

=INDEX(ImportHtml("https://www.tsp.gov/InvestmentFunds/FundPerformance/index.html", "table", 2), 2, 7)

Hope this helps!
texastexas
Posts: 5
Joined: Tue Oct 11, 2016 7:29 pm

Re: Importing TSP data to Google sheets

Post by texastexas »

I had OP's problem and your solution worked. Thanks ishkadetto.
sal paradise
Posts: 22
Joined: Sun Mar 11, 2018 1:38 pm

Re: Importing TSP data to Google sheets

Post by sal paradise »

ishkadetto wrote: Sun Feb 17, 2019 2:00 pm This works for me (note: column "7" is the G fund). Change that one number as needed for the column of the fund you need.

=INDEX(ImportHtml("https://www.tsp.gov/InvestmentFunds/Fun ... index.html", "table", 2), 2, 7)

Hope this helps!
Yes, thank you "ishkadetto". Maybe an administrator could update the Wiki link: "TSP share price in Google Sheets like GoogleFinance", https://www.bogleheads.org/wiki/Using_a ... _portfolio
User avatar
hoppy08520
Posts: 2164
Joined: Sat Feb 18, 2012 11:36 am

Re: Importing TSP data to Google sheets

Post by hoppy08520 »

As the author of that post 4+ years ago, I too noticed this too when my google sheet stopped working recently. I found that switching to the other URL (https://www.tsp.gov/InvestmentFunds/Fun ... index.html) worked, and I didn’t have to change the other parameters. I was going to update my post but wanted to give it one or two more days to see if this was just a short term glitch at the TSP website.
ishkadetto
Posts: 63
Joined: Thu May 24, 2018 2:49 pm
Location: California, USA

Re: Importing TSP data to Google sheets

Post by ishkadetto »

Anyone else having issues again? I'm getting errors but this time the link is still good so I don't know how to fix it.
eob616
Posts: 28
Joined: Sun Aug 26, 2018 10:01 am

Re: Importing TSP data to Google sheets

Post by eob616 »

Yup, I noticed this last night. Looks like it might be back up now, but if it goes down again, this is an alternative that works:

Code: Select all

=Index(ImportHtml("http://www.tspfolio.com/tspfunds", "table", 1), 2, 2)
[for G fund]
Post Reply