Page 1 of 1
					
				Accurate gold coin offer price scraping for the spreadsheet nerds
				Posted: Fri Jan 23, 2015 11:38 pm
				by fnord123
				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.
 
			 
			
					
				Re: Accurate gold coin offer price scraping for the spreadsheet nerds
				Posted: Sat Jan 24, 2015 12:59 am
				by Mark Leavy
				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.
 
			 
			
					
				Re: Accurate gold coin offer price scraping for the spreadsheet nerds
				Posted: Sat Jan 24, 2015 12:37 pm
				by fnord123
				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.
			 
			
					
				Re: Accurate gold coin offer price scraping for the spreadsheet nerds
				Posted: Sat Jan 24, 2015 12:56 pm
				by dualstow
				I don't know whether it's accurate, but I've been using the following for a long time
Code: Select all
=Index(ImportHTML("http://apmex.com/","table",1),2,2)
And I'm sure I got it from this forum.
 
			 
			
					
				Re: Accurate gold coin offer price scraping for the spreadsheet nerds
				Posted: Fri Jan 30, 2015 7:55 am
				by dualstow
				..and now it's showing gold at a spot price of $0.18 this morning.  

 Time to buy?  

 
			 
			
					
				Re: Accurate gold coin offer price scraping for the spreadsheet nerds
				Posted: Fri Jan 30, 2015 9:56 am
				by Khisanth
				Sometimes APMEX has different tables or something which fixes itself later on, so I have two formulas that I switch between.
Code: Select all
=Index(ImportHTML("http://www.cmegroup.com/trading/metals/precious/gold_quotes_globex.html","table",1),3,9)
or
Code: Select all
=Index(ImportHTML("http://apmex.com/","table",1),2,2)
Right now APMEX result for that table is FEB 2015 so I've switched to the CMEGROUP formula.[/code]
 
			 
			
					
				Re: Accurate gold coin offer price scraping for the spreadsheet nerds
				Posted: Fri Jan 30, 2015 9:57 am
				by dualstow
				Good to know, thanks!
			 
			
					
				Re: Accurate gold coin offer price scraping for the spreadsheet nerds
				Posted: Tue Jun 20, 2017 10:31 am
				by dualstow
				My code isn't working, and neither is Mark's. 
Anyone using a code in Google Docs that works today?
			 
			
					
				Re: Accurate gold coin offer price scraping for the spreadsheet nerds
				Posted: Tue Jun 20, 2017 1:07 pm
				by Mark Leavy
				dualstow wrote:My code isn't working, and neither is Mark's. 
Anyone using a code in Google Docs that works today?
=importhtml("
http://www.coloradogold.com/htsell.php","table",1)
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.
 
			 
			
					
				Re: Accurate gold coin offer price scraping for the spreadsheet nerds
				Posted: Tue Jun 20, 2017 1:26 pm
				by dualstow
				Weird, it still doesn't work. Maybe it's my sheet and not the code, somehow.
Thanks anyway, Mark.
			 
			
					
				Re: Accurate gold coin offer price scraping for the spreadsheet nerds
				Posted: Tue Jun 20, 2017 2:58 pm
				by flyingpylon
				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)
 
			 
			
					
				Re: Accurate gold coin offer price scraping for the spreadsheet nerds
				Posted: Wed Jun 21, 2017 11:16 am
				by dualstow
				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.
			 
			
					
				Re: Accurate gold coin offer price scraping for the spreadsheet nerds
				Posted: Wed Nov 29, 2017 11:01 am
				by dualstow
				Damn, the colorado gold link isn't working for me anymore. 
Code: Select all
=importhtml("http://www.coloradogold.com/htsell.php","table",1)
Going to try apmex again.
Nah, that's not working either. I should just type in the value manually once in a while.
 
			 
			
					
				Re: Accurate gold coin offer price scraping for the spreadsheet nerds
				Posted: Wed Nov 29, 2017 11:23 am
				by Kriegsspiel
				dualstow wrote:
Nah, that's not working either. I should just type in the value manually once in a while.
I just go to kitco and type in the gold spot price. No big deal.
 
			 
			
					
				Re: Accurate gold coin offer price scraping for the spreadsheet nerds
				Posted: Wed Nov 29, 2017 11:25 am
				by dualstow
				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.
			 
			
					
				Re: Accurate gold coin offer price scraping for the spreadsheet nerds
				Posted: Wed Nov 29, 2017 1:54 pm
				by flyingpylon
				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.
 
			 
			
					
				Re: Accurate gold coin offer price scraping for the spreadsheet nerds
				Posted: Wed Nov 29, 2017 3:17 pm
				by dualstow
				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.
			 
			
					
				Re: Accurate gold coin offer price scraping for the spreadsheet nerds
				Posted: Wed Dec 06, 2017 1:44 pm
				by Cortopassi
				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.
 
Thanks.  Apmex just seemed to go away again and this does work.
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.
 
			 
			
					
				Re: Accurate gold coin offer price scraping for the spreadsheet nerds
				Posted: Thu Feb 04, 2021 10:03 am
				by dualstow
				None of the codes on these two pages are working for me today. Maybe it's a Google Sheets problem.
			 
			
					
				Re: Accurate gold coin offer price scraping for the spreadsheet nerds
				Posted: Thu Feb 04, 2021 11:07 am
				by Mark Leavy
				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)
 
			 
			
					
				Re: Accurate gold coin offer price scraping for the spreadsheet nerds
				Posted: Thu Feb 04, 2021 2:32 pm
				by dualstow
				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.
 
 
			 
			
					
				Re: Accurate gold coin offer price scraping for the spreadsheet nerds
				Posted: Fri Feb 05, 2021 2:51 am
				by pors
				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 
