Accurate gold coin offer price scraping for the spreadsheet nerds
Moderator: Global Moderator
Accurate gold coin offer price scraping for the spreadsheet nerds
Someone messaged me about a way to get accurate offer prices for physical gold coins for valuing the physical part of the gold in their PP. Apmex posts buy prices on their web pages if you know where to look, so I put together an example that shows examples of how scrape those values into a Google spreadsheet. Here's the link in case anybody finds it useful.
https://docs.google.com/spreadsheets/d/ ... sp=sharing
I'd request that folks don't share this around too widely in other forums, as doing so will prompt the fine folks at Apmex to start mucking with their HTML/CSS/XML/etc. and break the spreadsheet.
https://docs.google.com/spreadsheets/d/ ... sp=sharing
I'd request that folks don't share this around too widely in other forums, as doing so will prompt the fine folks at Apmex to start mucking with their HTML/CSS/XML/etc. and break the spreadsheet.
- Mark Leavy
- Executive Member
- Posts: 1950
- Joined: Thu Mar 01, 2012 10:20 pm
- Location: US Citizen, Permanent Traveler
Re: Accurate gold coin offer price scraping for the spreadsheet nerds
Thanks Fnord. I've learned a lot from your spreadsheet samples.
This is what I use in my google docs:
=importhtml("http://www.coloradogold.com/selling.php",1,0)
This is in the A1 cell of a tab labeled "Gold Prices" and then all other cells refer to this tab.
This is what I use in my google docs:
=importhtml("http://www.coloradogold.com/selling.php",1,0)
This is in the A1 cell of a tab labeled "Gold Prices" and then all other cells refer to this tab.
Re: Accurate gold coin offer price scraping for the spreadsheet nerds
Nice web page find there! I particularly like it when I can extract a whole table of prices rather than one by one. I suspect Google spreadsheets run out of steam when you give them too many URLs to retrieve.
- dualstow
- Executive Member
- Posts: 15189
- Joined: Wed Oct 27, 2010 10:18 am
- Location: searching for the lost Xanadu
- Contact:
Re: Accurate gold coin offer price scraping for the spreadsheet nerds
I don't know whether it's accurate, but I've been using the following for a long time
And I'm sure I got it from this forum.
Code: Select all
=Index(ImportHTML("http://apmex.com/","table",1),2,2)
Monstres and tokeninges gert he be-kend, / And wondirs in the air send.
- dualstow
- Executive Member
- Posts: 15189
- Joined: Wed Oct 27, 2010 10:18 am
- Location: searching for the lost Xanadu
- Contact:
Re: Accurate gold coin offer price scraping for the spreadsheet nerds
..and now it's showing gold at a spot price of $0.18 this morning.
Time to buy? 


Monstres and tokeninges gert he be-kend, / And wondirs in the air send.
Re: Accurate gold coin offer price scraping for the spreadsheet nerds
Sometimes APMEX has different tables or something which fixes itself later on, so I have two formulas that I switch between.
or
Right now APMEX result for that table is FEB 2015 so I've switched to the CMEGROUP formula.[/code]
Code: Select all
=Index(ImportHTML("http://www.cmegroup.com/trading/metals/precious/gold_quotes_globex.html","table",1),3,9)
Code: Select all
=Index(ImportHTML("http://apmex.com/","table",1),2,2)
- dualstow
- Executive Member
- Posts: 15189
- Joined: Wed Oct 27, 2010 10:18 am
- Location: searching for the lost Xanadu
- Contact:
Re: Accurate gold coin offer price scraping for the spreadsheet nerds
Good to know, thanks!
Monstres and tokeninges gert he be-kend, / And wondirs in the air send.
- dualstow
- Executive Member
- Posts: 15189
- Joined: Wed Oct 27, 2010 10:18 am
- Location: searching for the lost Xanadu
- Contact:
Re: Accurate gold coin offer price scraping for the spreadsheet nerds
My code isn't working, and neither is Mark's.
Anyone using a code in Google Docs that works today?
Anyone using a code in Google Docs that works today?
Monstres and tokeninges gert he be-kend, / And wondirs in the air send.
- Mark Leavy
- Executive Member
- Posts: 1950
- Joined: Thu Mar 01, 2012 10:20 pm
- Location: US Citizen, Permanent Traveler
Re: Accurate gold coin offer price scraping for the spreadsheet nerds
=importhtml("http://www.coloradogold.com/htsell.php","table",1)dualstow wrote:My code isn't working, and neither is Mark's.
Anyone using a code in Google Docs that works today?
This is what I have been using for awhile. The old link stopped working when Colorado Gold reformatted the tables on their web page a while back.
- dualstow
- Executive Member
- Posts: 15189
- Joined: Wed Oct 27, 2010 10:18 am
- Location: searching for the lost Xanadu
- Contact:
Re: Accurate gold coin offer price scraping for the spreadsheet nerds
Weird, it still doesn't work. Maybe it's my sheet and not the code, somehow.
Thanks anyway, Mark.
Thanks anyway, Mark.
Monstres and tokeninges gert he be-kend, / And wondirs in the air send.
-
- Executive Member
- Posts: 1142
- Joined: Fri Jan 06, 2012 9:04 am
Re: Accurate gold coin offer price scraping for the spreadsheet nerds
APMEX changed their pages recently. Here's what I'm currently using, it seems to work for me.
=Index(ImportHTML("http://www.apmex.com/category/10000/gold","table",1),2,2)
=Index(ImportHTML("http://www.apmex.com/category/10000/gold","table",1),2,2)
- dualstow
- Executive Member
- Posts: 15189
- Joined: Wed Oct 27, 2010 10:18 am
- Location: searching for the lost Xanadu
- Contact:
Re: Accurate gold coin offer price scraping for the spreadsheet nerds
EDIT: suddenly the 'REF' error is gone and it's working again!
earlier:
Hmm, that's my regular, the one that hasn't worked for a while.
Guess it's my sheet. Weird.
earlier:
Hmm, that's my regular, the one that hasn't worked for a while.
Guess it's my sheet. Weird.
Monstres and tokeninges gert he be-kend, / And wondirs in the air send.
- dualstow
- Executive Member
- Posts: 15189
- Joined: Wed Oct 27, 2010 10:18 am
- Location: searching for the lost Xanadu
- Contact:
Re: Accurate gold coin offer price scraping for the spreadsheet nerds
Damn, the colorado gold link isn't working for me anymore.
Going to try apmex again.
Nah, that's not working either. I should just type in the value manually once in a while.
Code: Select all
=importhtml("http://www.coloradogold.com/htsell.php","table",1)
Nah, that's not working either. I should just type in the value manually once in a while.
Monstres and tokeninges gert he be-kend, / And wondirs in the air send.
- Kriegsspiel
- Executive Member
- Posts: 4052
- Joined: Sun Sep 16, 2012 5:28 pm
Re: Accurate gold coin offer price scraping for the spreadsheet nerds
I just go to kitco and type in the gold spot price. No big deal.dualstow wrote: Nah, that's not working either. I should just type in the value manually once in a while.
- dualstow
- Executive Member
- Posts: 15189
- Joined: Wed Oct 27, 2010 10:18 am
- Location: searching for the lost Xanadu
- Contact:
Re: Accurate gold coin offer price scraping for the spreadsheet nerds
Yeah, Kitco is where I usually peek outside of spreadsheets.
I just type 'k' into the chrome browser and chrome rolls its eyes and takes me there.
I just type 'k' into the chrome browser and chrome rolls its eyes and takes me there.
Monstres and tokeninges gert he be-kend, / And wondirs in the air send.
-
- Executive Member
- Posts: 1142
- Joined: Fri Jan 06, 2012 9:04 am
Re: Accurate gold coin offer price scraping for the spreadsheet nerds
Here's one that still works:
=Index(ImportHTML("https://www.moneymetals.com/precious-me ... ,"table",1),2,2)
It's getting more difficult to find sites still using tables, that deliver the same page content to both browsers and Google Sheets, and don't use javascript to populate the price value, etc.
=Index(ImportHTML("https://www.moneymetals.com/precious-me ... ,"table",1),2,2)
It's getting more difficult to find sites still using tables, that deliver the same page content to both browsers and Google Sheets, and don't use javascript to populate the price value, etc.
- dualstow
- Executive Member
- Posts: 15189
- Joined: Wed Oct 27, 2010 10:18 am
- Location: searching for the lost Xanadu
- Contact:
Re: Accurate gold coin offer price scraping for the spreadsheet nerds
It does indeed work, thanks! I keep all these different lines of code in the comment section of the gold price sell of my spreadsheet. That way I can try alternates when one fails.
Monstres and tokeninges gert he be-kend, / And wondirs in the air send.
- Cortopassi
- Executive Member
- Posts: 3338
- Joined: Mon Feb 24, 2014 2:28 pm
- Location: https://www.jwst.nasa.gov/content/webbL ... sWebb.html
Re: Accurate gold coin offer price scraping for the spreadsheet nerds
Thanks. Apmex just seemed to go away again and this does work.flyingpylon wrote:Here's one that still works:
=Index(ImportHTML("https://www.moneymetals.com/precious-me ... ,"table",1),2,2)
It's getting more difficult to find sites still using tables, that deliver the same page content to both browsers and Google Sheets, and don't use javascript to populate the price value, etc.
Otherwise, the other options I've considered:
1) Hey, not supposed to be looking at the PP every minute anyway. Just enter the price manually for gold.
2) Use GLD and a multiplier. I do this already as a backup. Gets you pretty close.
- dualstow
- Executive Member
- Posts: 15189
- Joined: Wed Oct 27, 2010 10:18 am
- Location: searching for the lost Xanadu
- Contact:
Re: Accurate gold coin offer price scraping for the spreadsheet nerds
None of the codes on these two pages are working for me today. Maybe it's a Google Sheets problem.
Monstres and tokeninges gert he be-kend, / And wondirs in the air send.
- Mark Leavy
- Executive Member
- Posts: 1950
- Joined: Thu Mar 01, 2012 10:20 pm
- Location: US Citizen, Permanent Traveler
Re: Accurate gold coin offer price scraping for the spreadsheet nerds
These two are both working for me right now.
Code: Select all
=importhtml("http://www.coloradogold.com/htsell.php","table",1)
Code: Select all
=importhtml("http://www.ajpm.com/gold-bullion.html","table",0)
- dualstow
- Executive Member
- Posts: 15189
- Joined: Wed Oct 27, 2010 10:18 am
- Location: searching for the lost Xanadu
- Contact:
Re: Accurate gold coin offer price scraping for the spreadsheet nerds
Mark Leavy wrote: ↑Thu Feb 04, 2021 11:07 am These two are both working for me right now.
...
Darn, they're not working for me. Thanks, anyway.
Monstres and tokeninges gert he be-kend, / And wondirs in the air send.
Re: Accurate gold coin offer price scraping for the spreadsheet nerds
Mark Leavy wrote: ↑Thu Feb 04, 2021 11:07 am These two are both working for me right now.Code: Select all
=importhtml("http://www.coloradogold.com/htsell.php","table",1)
Code: Select all
=importhtml("http://www.ajpm.com/gold-bullion.html","table",0)
Awesome thanks! The result takes up quite a few cells, but at least it works
