Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Google AJAX API from Excel?

Hi!

I'd like to access Google search from Excel to determine page rankings -
can anyone point me in the right direction, please?

I tried direct HTML access, but Google seems to detect and block this
after a few requests, so I'd like to use the AJAX API.

Thanks and best regards
Martin
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Google AJAX API from Excel?

Thsi code gets the number of results for a search at google.

Public Sub GoogleSearch()
'Use and input box for typing in the search words
Dim szSearchWords As String
Dim szResults As String
Dim ie As Object 'InternetExplorer

Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True

With Sheets("Sheet1")
RowCount = 2
Do While .Range("B" & RowCount) < ""

szSearchWords = .Range("B" & RowCount).Value


'Get keywords and validate by adding + for spaces between
szSearchWords = Replace$(szSearchWords, " ", "+")


ie.Navigate "http://www.google.com/search?hl=en&q=" & _
szSearchWords & "&meta="

'Loop until the page is fully loaded
Const READYSTATE_COMPLETE = 4
Do Until ie.ReadyState = READYSTATE_COMPLETE
DoEvents

Loop

Set Results = ie.document.getelementsbytagname("P")
For Each itm In Results
If InStr(UCase(itm.innertext), "RESULTS") Then
MsgBox (itm.innertext)
'really item 3, but arrays staarts at 0
NumberofResults = itm.Children.Item(2).innertext
.Range("C" & RowCount) = NumberofResults
Exit For
End If
Next itm
RowCount = RowCount + 1
Loop
End With
'Explicitly clear memory
Set ie = Nothing
End Sub






"Martin Schneider" wrote:

Hi!

I'd like to access Google search from Excel to determine page rankings -
can anyone point me in the right direction, please?

I tried direct HTML access, but Google seems to detect and block this
after a few requests, so I'd like to use the AJAX API.

Thanks and best regards
Martin

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Google AJAX API from Excel?

Joel schrieb:
Thsi code gets the number of results for a search at google.


Hi, Joel,

thanks for the idea. Unfortunately this triggers the anti-spam-mechanism
at Google as well. I'd like to try the official way, do you have code
for this as well?

Thanks and best regards,
Martin
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Google AJAX API from Excel?

I did something similar to this a couple of months ago. I don't know HTML
but I helped somebody use the google tanslation API

see posting

http://www.microsoft.com/office/comm...xp=&sloc=en-us


Joe wrote HTML code to use the translation API and I wrote the code to run
the html and put the data in a speadsheet.

See if this code causes the anti-spam to trigger. If it doesn't then we can
do something similar for your API.

"Martin Schneider" wrote:

Joel schrieb:
Thsi code gets the number of results for a search at google.


Hi, Joel,

thanks for the idea. Unfortunately this triggers the anti-spam-mechanism
at Google as well. I'd like to try the official way, do you have code
for this as well?

Thanks and best regards,
Martin

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Google AJAX API from Excel?

Joel schrieb:
I did something similar to this a couple of months ago. I don't know HTML
but I helped somebody use the google tanslation API

see posting

http://www.microsoft.com/office/comm...xp=&sloc=en-us


Hi, Joel,

thanks for the link. It pointed me into the right direction. Of course
now I have another question (which of course isn't strictly Excel
anymore, but I hope I may ask this as well).

http://ajax.googleapis.com/ajax/serv...1.0&q=question

gives me search results from google.com - is there a way to get results
from google.de? I was unable to find a corresponding parameter...

Thanks and best regards,
Martin


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Google AJAX API from Excel?

I don't know. I will search around the web later but not sure if I will find
anything.

"Martin Schneider" wrote:

Joel schrieb:
I did something similar to this a couple of months ago. I don't know HTML
but I helped somebody use the google tanslation API

see posting

http://www.microsoft.com/office/comm...xp=&sloc=en-us


Hi, Joel,

thanks for the link. It pointed me into the right direction. Of course
now I have another question (which of course isn't strictly Excel
anymore, but I hope I may ask this as well).

http://ajax.googleapis.com/ajax/serv...1.0&q=question

gives me search results from google.com - is there a way to get results
from google.de? I was unable to find a corresponding parameter...

Thanks and best regards,
Martin

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
AJAX : Dynamlically pushed JavaScript not working after Update Panel is updated Arachnid Excel Programming 0 October 5th 07 10:15 AM
Excel on the web similar to google spreadsheets Alex Excel Discussion (Misc queries) 1 February 24th 07 03:33 PM
Google search box on excel Dileep Chandran Excel Worksheet Functions 7 November 10th 06 04:14 AM
AJAX combo box in excel [email protected] Excel Programming 0 June 20th 06 10:41 AM
Google search from excel Ant[_5_] Excel Programming 1 August 31st 04 08:46 PM


All times are GMT +1. The time now is 12:52 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"