0

The following link has a button as "Export to Excel". When clicked, it downloads an Excel sheet with details for the particular stock.

I want to get this downloaded excel file through Excel VBA, where I have a set of links it loops through them download books from each link, copy certain data and paste it. While writing the code I realised that for downloading from web, the link should end with xlsx or csv or something related to excel.

Sub transfercsv()
sLink = "http://www.screener.in/company/?q=500095" 'I can loop and attach links to this..
sfile = "downloaded.xls" 'I can get this rectified as well...
ssheet = "Data sheet" 
'Further code I can build up
....
End sub

Final question: "How can I ask Excel VBA to download the workbook behind the Export to Excel link."

or

"How can I find the xlsx link behind the Export to Excel button."

P.S:- I have tagged as JSON as well, becasuse while researching I found the the export link has something to do with JSON..

4

1 回答 1

2

我是 Screener.in 的 Pratyush。

由于这些技术原因,上述方法不起作用:

  1. 导出功能使用 POST 请求。
  2. 该页面位于用户登录后面。
  3. 发布请求具有 CSRF 保护以防止自动化。

这样做是因为生成自定义 XLSX 文件是繁重的服务器动态过程,并且在共享主机上我们的资源有限。

更好的选择是使用 Google Docs 工作表。他们有一个与 Google Finance 集成的精彩 API,可以提供大部分财务数据。

于 2013-10-15T11:22:35.450 回答