Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

is there any way a spreadsheet program (like Excel) can communicate with a search engine (like Google or WolframAlpha ?)

The perfect method would be a excel macro that could ask feed the search engine and return results. Simply the number of hits would be sufficient.

Second best would be a search engine that could import .csv type files and save results.

Does anyone know of such a product?

share|improve this question

Yes. It is possible. I successfully automated Internet Explorer in excel to get aviation weather into the excel sheet. Search on Google to automate internet explorer and you will want to get the innertext retuned with what you are looking for. This is an excerpt of that code to get the aviation weather and field elevation for a particular airport. The code is written in VBA. You can load a CSV file into excel and then loop through the records running the macro for the results.

On Error GoTo errHandler
Dim adPost() As Byte, strPage As String
Set ie = CreateObject("InternetExplorer.Application")
'ie.Visible = True

adPost = StrConv("station_ids=" & strAirport & "&std_trans=1, ", vbFromUnicode)

ie.navigate "", , , adPost, _
  "Content-Type: application/x-www-form-urlencoded" & vbCrLf

Do While ie.busy: DoEvents: Loop
Do While ie.ReadyState <> 4: DoEvents: Loop

Dim strText As String, strElevation As String, strAPName As String, strAirportInfo As String

strText = ie.document.body.innertext

Debug.Print strText
strText = Right(strText, Len(strText) - InStr(1, strText, strAirport) + 1)

ie.navigate "" & strAirport
Do While ie.busy: DoEvents: Loop
Do While ie.ReadyState <> 4: DoEvents: Loop
ie.Visible = True

strAirportInfo = ie.document.body.innertext
strElevation = Left(strAirportInfo, 500)
strAPName = Left(strElevation, 150)
If InStr(1, strElevation, "Elevation") > 0 Then
  strElevation = Right(strElevation, Len(strElevation) - InStr(1, strElevation, "Elevation") + 1)
  strElevation = Left(strElevation, InStr(1, strElevation, "."))
  strElevation = Left(strElevation, InStr(1, strElevation, " ft.") - 1)
  strElevation = Right(strElevation, Len(strElevation) - InStr(1, strElevation, " "))
  strElevation = ""
End If

Debug.Print strAPName
If InStr(1, strAPName, strAirport) > 0 Then
  strAPName = Right(strAPName, Len(strAPName) - InStr(1, strAPName, strAirport) - 3)
  strAPName = Left(strAPName, InStr(1, strAPName, "GOING TO") - 1)
  strAPName = Trim(Replace(strAPName, vbCrLf, " "))
  strAPName = strAirport
End If
share|improve this answer
Thank you! That got me started :-) Do you happen to know how to simply return the number of Google hits for a query? – Helge Jun 20 '10 at 7:35
You'll have to do the same thing that I did up top. Instead of searching for "Elevation" in the "ie.document.body.innertext" you would search for "About" and then parse the string to get the number of hits. – wbeard52 Jun 20 '10 at 16:38

They have something that is extremely close and allows export:

If that isn't quite what your looking for, then wbeard's solution, while requiring coding, is a very good answer

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .