Excel + 搜索引擎?

Excel + 搜索引擎?

电子表格程序(如 Excel)是否可以与搜索引擎(如 Google 或 WolframAlpha)进行通信?

完美的方法是使用 excel 宏,它可以向搜索引擎请求信息并返回结果。只需命中次数就足够了。

第二好的是可以导入.csv 类型文件并保存结果的搜索引擎。

有人知道这样的产品吗?

答案1

是的。这是可能的。我成功地在 excel 中自动化了 Internet Explorer,将航空天气信息放入 excel 表中。在 Google 上搜索自动化 Internet Explorer,您会希望获得与您正在寻找的内容相匹配的内部文本。这是该代码的摘录,用于获取特定机场的航空天气和场地海拔。该代码是用 VBA 编写的。您可以将 CSV 文件加载到 excel 中,然后循环遍历运行宏的记录以获取结果。

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 "http://aviationweather.gov/adds/metars/index.php", , , 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 "http://www.airnav.com/airport/" & 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, " "))
Else
  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, " "))
Else
  strAPName = strAirport
End If

答案2

他们有一些非常接近且可以出口的东西: http://www.google.com/squared

如果这不是你想要的,那么 wbeard 的解决方案虽然需要编码,但却是一个很好的答案

相关内容