Message from Rajib
Thanks a ton!
It seems to be a big problem if these things don’t get fixed. All the indices are out of my charting software!
I can manage to write a VBA that will collate individual files and write it in the CSV. But I need something that will download the EOD text files for these indices into once place! That too me is more tedious than writing it on to the csv file.
Here is a initiative from me to automate the NSE EOD data in ASCII format using simple VBA Scipts in MS Excel. The following MS Excel VBA macro copies the Getbhavcopy zip file corresponding to 02Nov2010 from NSE India portal into your local drive(c:eoddata) and then extracts the Zip file and shows you the content in the csv file.
This is one of the primary requirment to develop the macro further. And for me its works fine and few more steps needs to be taken to design a Getbhavcopy Ascii
format downloader using MS EXCEL. And as of now its not for commercial use. The macro can be used only for testing/development purpose
Pre-Requisite to run the macro
1)Create a Folder Name eoddata in C drive
2)Make Sure that you had added the Reference xzip.dll which is used to zip or unzip files
3)To install X-Zip.dll reference please visit and read the X-Zip.dll I.e X Standard – Zip 2.5 installation instructions
4)Make Sure that you had enabled the correct Macro security settings.
4)Go to Tools->Macro and Run the EODData Macro
Here is the VBA Macro Code
Private Declare Function URLDownloadToFile Lib “urlmon” Alias _
“URLDownloadToFileA” (ByVal pCaller As Long, _
ByVal szURL As String, _
ByVal szFileName As String, _
ByVal dwReserved As Long, _
ByVal lpfnCB As Long) As Long
Function DownloadFile(URL As String, LocalFilename As String) As Boolean
Dim lngRetVal As Long
lngRetVal = URLDownloadToFile(0, URL, LocalFilename, 0, 0)
If lngRetVal = 0 Then DownloadFile = True
Dim sURL As String
Dim LocalFilename As String
Dim filename As String
Const UNC = “C:eoddata”
fname = “cm02NOV2010bhav.csv”
zipfilename = fname & “.zip”
sURL = “http://nseindia.com/content/historical/EQUITIES/2010/NOV/” & zipfilename
LocalFilename = UNC & zipfilename
Debug.Print DownloadFile(sURL, LocalFilename)
Set objZip = CreateObject(“XStandard.Zip”)
objZip.UnPack LocalFilename, UNC
Set objZip = Nothing
Workbooks.Open filename:=UNC & fname
Hope the complete solution will be soon available in our blog with free and open source VBA codes 🙂