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..

1 Answer 1

2

This is Pratyush from Screener.in.

The above won't work because of these technical reasons:

  1. The export function uses POST request.
  2. The page is behind a user login.
  3. The post request has CSRF protection to prevent automation.

This has been done because generating customized XLSX files is heavy and server dynamic process, and being on a shared host we have limited resources.

A better alternative can be to use Google Docs worksheets. They have a wonderful API integrated with Google Finance which can provide much of the financial data.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks Pratyush...... Im googling your words as well...if you can guide me to any links for the same...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.