简体   繁体   English

可刷新 Web 查询使用 Excel 2010 和参数

[英]Refreshable Web Query using Excel 2010 and Parameters

I'm looking to pull into the XML feed from Feedburner's API.我希望从 Feedburner 的 API 中提取 XML 提要。 This is just a matter of writing the URL and using the "From Web" data connection in Excel.这只是编写 URL 并使用 Excel 中的“来自 Web”数据连接的问题。

https://feedburner.google.com/api/awareness/1.0/GetItemData?uri=RSSFEEDNAME&dates=2011-08-01,2011-08-05 https://feedburner.google.com/api/awareness/1.0/GetItemData?uri=RSSFEEDNAME&dates=2011-08-01,2011-08-05

This works fine (and is pretty fast).这工作正常(并且非常快)。

Now, I'd like to be able to update two cells in the "dates" sheet to have it pull that range of data.现在,我希望能够更新“日期”表中的两个单元格,以使其提取该范围内的数据。 This is done using parameters in the URL:这是使用 URL 中的参数完成的:

https://feedburner.google.com/api/awareness/1.0/GetItemData?uri=RSSFEEDNAME[] https://feedburner.google.com/api/awareness/1.0/GetItemData?uri=RSSFEEDNAME[]

Using the Excel UI, I can then assign the [] to any cell.使用 Excel UI,我可以将 [] 分配给任何单元格。 However, no matter what I try, this doesn't work.但是,无论我尝试什么,这都行不通。 I initially thought there might be some issue with the date format so I've worked myself to the point where I am entering into the cell, the exact copy (&dates=2011-08-01,2011-08-05) as text.我最初认为日期格式可能存在一些问题,所以我自己努力到我输入单元格的地步,确切的副本(&dates=2011-08-01,2011-08-05)作为文本。

Each time, the feed pulls up with just the current days data (which is the default behavior when no dates are specified).每次,提要都只显示当前日期数据(这是未指定日期时的默认行为)。 It isn't giving an error (which it will do for relatively small infractions, like not having two-digit months) which makes me think it just simply isn't replacing the [] with the specified text.它没有给出错误(它会针对相对较小的违规行为,比如没有两位数的月份),这让我认为它只是没有用指定的文本替换 []。 I'm also using this same method for a WebTrends Web Service query and gettign similarly frustrating results.我也在对 WebTrends Web 服务查询和 gettign 使用同样的方法,结果同样令人沮丧。 I've read every how-to on web queries, and I'm following them exactly.我已经阅读了有关 web 查询的所有操作方法,并且我完全按照它们进行操作。

I can't find any place to see what the final URL Excel is requesting, so it's a bit of a shot in the dark.我找不到任何地方可以看到最终的 URL Excel 要求什么,所以这有点像在黑暗中拍摄。 Any thoughts on next steps would be greatly appreciated!任何关于下一步的想法将不胜感激!

Best, Nathan最好的,内森

The answer was no to use the Web Query "wizard" and just do it by hand.答案是否定的,不使用 Web 查询“向导”,只需手动操作即可。

  1. Open Notepad (or some text editor)打开记事本(或一些文本编辑器)
  2. In the editor type the following four lines:在编辑器中键入以下四行:

     WEB 1 http://example.com/index.html?something=[]&somethingelse=[] [BLANK]
  3. Save it as anything with an.iqy extension.将其保存为任何带有 .iqy 扩展名的内容。
  4. Open Excel, go to the Data ribbon, and click "Existing Connections"打开 Excel、go 到数据功能区,然后单击“现有连接”
  5. Click "Browse for More..."点击“浏览更多...”
  6. Find the IQY file you made and click "Open"找到您制作的 IQY 文件,然后单击“打开”

Excel will then ask you where you want to put the resulting data, followed by prompts for each placeholder you entered in the URL. Excel 然后会询问您要将结果数据放在哪里,然后提示您在 URL 中输入的每个占位符。 Those prompts let you either type in a value, or select a cell to act as the data.这些提示让您可以输入一个值,或者 select 一个单元格作为数据。

I would have thought that dates should have been a named parameter and that you should link that to whichever cell has the date value(s).我原以为dates应该是一个命名参数,并且您应该将其链接到具有日期值的任何单元格。

The cell should just have 2011-08-01,2011-08-05 as its value as long as you create the named parameter dates and link it to that cell只要您创建命名参数dates并将其链接到该单元格,该单元格就应该只有2011-08-01,2011-08-05作为其值

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM