This Excel spreadsheet downloads multiple historical stock quotes into Excel. Just enter a series of ticker symbols, two dates, and click a button.
Update on 2nd May 2022: Fixed to work past some Yahoo changes.
Update on 14th April 2018: Yahoo changed a few things, so I’ve updated the downloader to work again
Update on 11th July 2017: You can now sort the historical data in ascending or descending date order
Update on 6th July 2017: I’ve uploaded a new version of the Yahoo spreadsheet that now works again. Download the new version at the bottom of this article. Comments welcome.
Update on 20th May 2017: Yahoo Finance have discontinued their free historical data API. As a workaround, I’ve posted a new version of the spreadsheet that uses Google Finance.
This data can be used for correlation analysis, technical analysis with RSI and ATR, historical back-testing, portfolio optimization and much more.
A previous spreadsheet let you download data for a single ticker symbol. Sometimes, however, data for just one company isn’t enough – you need to compare the relative performance of several companies. That’s when you need this free, user-friendly spreadsheet for bulk data download.
The spreadsheet is simple to use. Start by entering a start and end date, your desired quote frequency (d for daily, m for monthly, y for yearly), and your desired sorting (oldest data first or newest data first).
You can also specify if you want the data for each ticker written to separate CSV files. If so, specify an export folder for the files.
Then enter a list of ticker symbols in cell A11 and below (one tick per cell). After you click “Get Bulk Quotes”, the spreadsheet downloads the historical stock quotes into individual sheets. The sheet name is the ticker symbol.
The spreadsheet downloads the date, open price, high price, low price, closing price, volume and adjusted close price.
If you add or remove tickers , or refresh the data, the spreadsheet deletes the existing quote sheets, and inserts new sheets with the new data.
If you asked the spreadsheet to export the data, you’ll find a CSV file for each ticker in the folder you specified.
The file name is constructed from the ticker, start date, end date, and the download frequency.
If you misspell a ticker or leave a blank, the VBA is clever enough to skip over or ignore the error. You won’t get any nasty error messages.
You’ll also get a list of tickers for which no data was found. This list is dynamically updated by the VBA.
I’ve tested the spreadsheet by downloading historical quotes for 180 ticker symbols. Everything worked perfectly, with 180 new sheets added to the workbook, each filled with historical data.
You can also collate the open, high, low, close, adjusted close and volumes for every ticker on the same sheet. That is, you can collect all the open prices on one sheet (named “Open”) together with the corresponding dates, all the high prices on one sheet (named “High”) together with the corresponding dates etc. Simply check the “Collate” button.
The collate feature correctly reconciles tickers that return data with differing time series – dates and values are correctly associated.
The VBA is not protected; you can view and modify the code. Please let me know if you have any suggestions for improvements or additions to the functionality.
Get Excel Spreadsheet to Download Bulk Historical Stock Data from Yahoo
Get Excel Spreadsheet to Download Bulk Historical Stock Data from Google Finance
Hi Samir -thank you for kindly providing your excel spreadsheet for downloading multiple tickers. I would like to use this for screening stocks and displaying the price on a chart but my programming skill is not very good.
If you have spare time could you add two more sheets to your spreadsheet which allows me to select the ticker from a drop downlist which I can perform calculations on and plot these on a graph on a second sheet? Thank you again for providing your spreadsheets and support with this enquiry.
kind regards,
Kanu
Downloader works nicely. Good job.
Could the code be modified so that;
1. a sheet named Charts could be created and not deleted,
2. the data only appends new data if existing data exists instead of always downloading entire date range every time.
3.Existing sheets not be deleted, just append new data to the specific cells needed so that user created formulas would be saved
Thanks!
Hi – Samir…your site is amazing! thanks for all you do…
One question on this downloader, can you post a code that will download the data sorted from newest to oldest based on the date? I went into the code but since I am not that savvy I couldn’t figure it out..
Thanks!
In the VBA, change Order:=xlAscending to Order:=xlDescending
Hi Samir,
I use the same parameters everyday. Some days it works and some days it doesn’t. I mostly fail because all stock tickers show up in ‘Failed’ but I use the same tickers everytime. Any clues?
I was able to modify it to descending. I tried adding some other calculations but I am getting an error.
How Do I contact you for custom work?
Go to the privacy policy page, and use the email address there
Samir thanks so much for the code.
I am looking to do the following:
Instead of having all of the entered tickers appear in separate tabs, I would like to have the tickers appear with the respective information in the same tab…. For example: If I have 50 stocks entered on the “Parameters” tab – What code must be entered to enable me to view those 50 stocks in the same new tab (within the same workbook)..
I essentially want to be able to have a spreadsheet that I can enter as many stocks as possible into and have real-time data within the spreadsheet that I can view on one tab…
If you could let me know how to execute this I’d be forever grateful!
Also, if you have time… How do I change the criteria that refreshes and is visible for each ticker? For example, if I want to add Short Interest and Average Daily Volume and Sub-sector or Industry, how can I do this? I am fully subscribed to FinViz and if you could explain to me how to change the criteria within VBA or the spreadsheet that would be so great.
Thanks so much.
JLebowitz@trilliumtrading.com
I too would love to see all quotes on the same tab if I was looking at one day worth of data.
Hi Samir – like Jake and Rick, I too would like to see all data for all dates entered on the same tab (usually entering one week).
E-mail: karan.desai@td.com
Hi Samir, lot’s of good stuff on this site. I’m looking to do some specific live quote stock analysis. I’ve browsed through the Excel import spreadsheets you have on here and am not sure if I found what I’m looking for. Here’s what I hope to do:
Import live quotes and associated data (delayed is ok) from Google or Yahoo for a selection of some 50 companies. I want to be able to choose the companies at the outset, as many are either quite small (and not on the list of 6800 you have on one particular spreadsheet) or in foreign markets .
Did you already do something like this? If not, can I modify one of your current spreadsheets relatively easily? I have some limited VBA skill.
Thanks very much. Again, great work.
Hola Samir,
Muchas gracias por ofrecer la hoja de cálculo. Cuando pongo el ticker de un valor del Ibex35, la hoja de cálculo me dice que no los reconoce. Podrías, por favor, decirme como tengo que hacer para poder importar los valores historicos de acciones del Ibex35.
Anticipadamente, muchas gracias.
(Translated)
Thank you very much for providing the spreadsheet. When I put the ticker of a value of Ibex 35, the spreadsheet tells me it does not recognize. Could you please tell me how I have to do to import the historical values of the Ibex 35 shares.
In advance, thank you very much.
Great job Samir. This spreadsheet is obviously perfect. Can I possibly get the one to Download Bloomberg Stock Quotes into Excel? The reason being that the Tickers I am looking for only exist on bloomberg.
Thanks a lot.
I believe bloomberg is a subscription service (unless you’re talking about http://www.bloomberg.com/markets/).
I don’t have a subscription so I can’t develop an Excel connector
Hi Samir, excellent work you’ve done here
Actually you can download manually all data using this method :
http://www.bloomberg.com/apps/data?pid=webpxta&Securities=TICKER&TimePeriod=6Y&Outfields=HDATE,PR005-H,PR006-H,PR007-H,PR008-H,PR013-H
Replace the TICKER with bloomberg stock code
Example : http://www.bloomberg.com/apps/data?pid=webpxta&Securities=TLKM:IJ&TimePeriod=6Y&Outfields=HDATE,PR005-H,PR006-H,PR007-H,PR008-H,PR013-H
It would be great if this data can be transfer to excel
Manually, you can supply the URL in Excel: Choose “Data”, “From Web” and supply the URL stated, press go and you will see the data. Then press the import button at the bottom of the window. Then data will be imported to excel. But you need to separate the data into columns. You can goto “Data” and select “Text to Columns” to separate the column with delimiter “. I am trying to see if I can do the program as I haven’t written VBA for a long time and retrieve data from the web is new to me. By the way, is there a simple instruction to download the data of ALL stocks from a particular exchange for a particular day? Can you explain the coding in your URL in details? (I think 6Y stands for 6 years, right). How about 52 high, 52 low…etc
Samir,
Great job.
Here’s an idea for added functionality.
I plan to use this to update prices for the same tickers on a regular basis. I would like to add columns to the right of the Yahoo price output, in order to calculate certain items (high minus low, moving averages, etc.). But currently, these formulas would be written over each time I update the prices. Is there a way to have the range limited to a certain number of columns, so that calculations I add to the right of the output on each worksheet do not get erased?
Best,
Russ
Hi Russ – yes, you can modify the VBA so that your calculations (MAs, high minus low etc) are added to the right of the Yahoo prices.
Look into the FormulaR1C1 syntax in VBA. It’s pretty simple.
Samir
Hi Samir,
Good job done!
Can you please tell me how to update only certain columns and retain balance while updating everytime.
Because I have made some calculations inserted in columns which should be retained after updating the fields also. In addition, how to update only few spreadsheets out of many.
Thanks,
Pari
hi
thanks a ton for the great utility, untill now i had to download through http://ichart.finance.yahoo.com/table.csv?s=
individually each stock , so you can understand the pain 🙂
am i able to import data from this sheet or create csv from sheet automatically according to mt4 format ?
regards
I don’t know what mt4 format is
Samir
Could you give some more information where to add the calculation code? For example, I would like to display the Tickers and 10-month SMA on the Parameters sheet. I’m not clear where in the code to add this calculation. Maybe in a separate sub routine?
Thanks for your work.
Daniel
Hi Samir,
Is it possible to insert the ticker symbol in the Column A on each worksheet? Also, is it possible to have all results inserted into one sheet, instead of individual sheets for each stock?
Thanks,
Tom
Hi Tom
Yes, it’s possible to do all this. Are you asking that I do this?
Samir
Having the option to download all of the data to a single worksheet would be a huge help. I’m working with a few other tools that really need to be able to reference the data side-by-side and while I can make a sheet consolidating all of the reference cells onto one page, this really slows down the processing and makes the document almost unworkable.
Hi there,
I would like to second Michael H’s request. That will be really helpful if the data can be combined into a single worksheet. Furthermore, if the data can even contain historical fundamental information that will be even better. Thank you so much.
Samir,
Thank you so much for your work on this. It really is a phenomenal tool. Could you please make this go into one spreadsheet as the gentleman above mentioned? If not, could you point me in the right direction. Thanks so much again!
I would like to +1 that request. 🙂
An example of how this might be used:
Comparing prospective buy opportunities.
– run a stock screener
(some fields are not available in results, and some needed filtering is unavailable)
– paste all the symbols from screener output
– limit date range to 1 day
– run, filter and sort
Thanks for your excellent work Samir. Also, may I add a link to your site from my resources page? http://nFol.io/resources
Monte
nFol.io
Hi Smair, great work as always…I am not a VBA specialist like yourself. I was hoping you could walk me through how to have each ticker create its own csv file in a specified folder; if this is even possible.
Thanks and I do have some custom work to be done. I’ll be reaching out when I finish a few things.
As always thanks for your help,
RJ
Hi Research Junkie
I’ve updated the spreadsheet so you have an option to export the quotes for each ticker to separate CSV files.
Samir
Hi Smair,
Great work.
I am new to VBA. I don’t know why this works fine with my PC running Office 2010 but it does not work in Mac Office 2011 prompted with error in the syntax StartMonth = Format(Month(StartDate) – 1, “00”)
I have changed the date format on the Parameter sheet but still could not solve the problem.
Could you let me know how to solve this? Thanks!
Long time in the coming, but the new version I’ve just uploaded should work on a Mac
Hi, Samir
I am not able to download the data for nifty and other futures stocks in India market
Basically I want to determine the volatility of any particular stock in Indian market and use it in black scholes formula to find the value of option and check its variance from the original data
Can u help me out in that regard
The spreadsheet connects to finance.yahoo.com. If finance.yahoo.com doesn’t have historical prices for your Indian stock ticker, then the spreadsheet won’t work for you.
Hello Samir.
Im very appreciated your big work here…Extremely usefull to me…
Before this im using this link “http://table.finance.yahoo.com/table.csv?s=^KLSE&a=01&b=01&c=1998&d=3&e18&f=2013&g=d&ignore=.csv” to download 200 stocks data every day… need to change the stock name and the date for every single stocks…Lot of time…
Today, i found ur work may save a lot of my time.. Thanks to you.. and thumbs up..
seperate tab of every stock, can i export it into seperate .csv?
Thanks in advance.
Hey Epul!
I’ve added an “Export to CSV” option. It exports data for each ticker to its own CSV file, in a folder that you specify
Samir
Thanks a lot Samir…
Big thumbs up for you for your effort…
Really appreciate it mate..
Recomended to all… =)
Regards.
Thanks a lot, but it does not work on my Mac. I got Office 2011, but it won’t even run. What to do?
Don’t know why it doesn’t work on a Mac. I only have a Windows 7 laptop. Not rich enough to buy a Mac 🙁
The first thing you will need to do is enter you stock symbols in Row A10 not A11
The program begins looking for stock symbols in line 10 when it finds the
Enter Tickers Below comment it tries to look up the symbol and bombs out.
(this may not be the big error see below but it won’t hurt)
Also
In the “Sub DownloadStockQuotes” portion of the code comment out these lines
‘ .PreserveFormatting = True
‘ .RefreshPeriod = 0
‘ .WebSelectionType = xlSpecifiedTables
‘ .WebFormatting = xlWebFormattingNone
‘ .WebTables = “20”
‘ .WebPreFormattedTextToColumns = True
‘ .WebConsecutiveDelimitersAsOne = True
‘ .WebSingleBlockTextImport = False
‘ .WebDisableDateRecognition = False
‘ .WebDisableRedirections = FalseL
After that it ran fine for me.
This was a machine specific error no reflection on Samir Khan.
Samir Khan you did a good job, thanks for the code.
Good luck.
Thanks for spotting the issue with row 10 vs row 11. I’ve fixed it!
Karl7,
If data for particular stock symbol is not available then the code is getting stuck at refresh.backgroundquery:=False
After that it is not continuing with the loop.
This is happening only with mac. With windows the loop continues even-if data is not available for any stock ticker.
Please help !
I just added:
Dim ticker As Integer
(I did this based on an error i got on the version of code that was provided that downloads all quotes to a single sheet.)
Then made the other changes Karl7 submitted
It worked, Mac changeover has been a headache
Thanks Samir, way farther than i would ever be if it wasn’t for you. Karl7 thanks for the Mac translation
I’ve just added your Max fix to the most recent version of the spreadsheet. Many thanks for looking into this.
Ken, I’ve been doing a lot of research on pulling Yahoo info into Excel and I remember reading something along the way that some macro functions are not supported on Mac / Office 2010 products. I’ve read 1,000 websites over the last few weeks so I can’t remember where I saw that but you may want to look in the Microsoft Developers Network information.
Hi would it be possible to merge this spreadsheet with the one compiling the correlation matrix? it would be very handy to just specify a stock symbol list and get directly the correlation matrix in the same worksheet.. 🙂
Yes, that’s what I’m aiming for!
How do you get rid of the portion of code that removes worksheets without getting a Error 1004? I’d like to add this to an existing workbook. Thanks!
Hi Samir,
Thank you so much for creating this… this is exactly what I’ve been looking for… however, do you know if there is a way we can edit the code so that it does not delete all other prior tabs? I have my own Summary tab, along with others for Charts that I’ve created, but each time I run the macro it deletes all other tabs so I have to keep my work in a different file and then try to merge the two after it gets done running. I’ve tried altering the code to not delete the other tabs, but I keep receiving errors. Any help would be greatly appreciated!
Thanks again and regards,
Steve
Try this file:https://investexcel.net/wp-content/uploads/2013/04/Multiple-Stock-Quote-Downloader-with-CSV-Export-Preserve-Data.zip
Any data in columns to the right of H is preserved. You HAVE to make sure that the tab for every ticker already exists before you update the sheet (i.e. there has to be a tab whose name is the ticker symbol)
Hello Samir. First, this spreadsheet is exactly what I was looking for!! Thanks. I am not a expert in VB but I am learning and this is a time saver. I tried the version that preserves data and it didnt download any new price data.
I got it to write the data in decending order by changing the Sort function. (Order:=xlDescending).
I need help with one small change to it. for every ticker, it clears the sheet that the data is written to.
My plan is to use this to weekly download ticker data into columns A:G and I will have formulas in Columns H,I,J,K, etc…. and I want these to be preserved.
It would be great if there was a “check box” on the Paramerters page that, if checked, wouldn’t erase anyting to the right of column G for “existing” tabs. I may add new tickers from time to time.
Can you help me with adding this? I attached a modified copy of your spreadsheet that has two changes. 1. the end date on Parameters is Today(). 2. the sort order is decending on each tab so the newest data is at the top.
Hi Samir,
Your multiple stock downloader has been very helpful. It seems to work well except for the monthly frequency option. The start quote date is correct as input but the remaining quote dates are all at the first day of the month. I have been trying to find out how to correct this but I am not experienced with VBA. Can you help see if and how to correct this?
Hi Samir,
I worked on the m frequency problem a little more and found that yahoo finance is actually downloading the data for the end of each of the months. I would like to get data at monthly or weekly intervals for a spreadsheet tracking portfolio yields at the specified intervals. Like starting on 9/12/12 with data on 9/12/12, 10/12/12, 11/12/12, 12/12/12, 1/12/13, 2/12/13, 3/12/13, 4/12/13. Looks like I would have to get the data for the d frequency and parse it for monthly or weekly intervals? Thanks for the start though.
Hi Samir,
Great work – was looking for a multiple historical quotes downloader!
Are you interested in adding other calculations to the tab sheets?
Example: Standard Deviation, Beta, Volatility?
If so, please contact me direct.
Hi Samir,
To follow up on Tom K’s request above, how should I modify the code to insert the ticker into column “A” of the output? I use these files to dump data into some back testing software, and it needs the ticker in one of the columns in order to process the data
Also, is there any way to allow this script to overwrite any .csv files that are already in the output folder? (As it is right now, we just have to manually click “yes/no” for each of the folders that are already in the folder.
Many thanks for your hard work, this is HUGE help to me!
Hi Samir,
Thanks for sharing your work with us.
I am relatively new with VBA and am planning to build a Excel sheet to download historical quotes from Yahoo and Quotemedia, because certain ticker symbols are not supported by Yahoo anymore (for example ^DJI, ^DJT, ^DJU, ^DJC).
Do you if there is of you have a solution for this problem?
I am a Metastock user and would like to have a input file in csv format containing the price data from the last 20 day for a list of tickers symbols.
The Quotemedia VBA code I am planning to use is:
http://app.quotemedia.com/quotetools/getHistoryDownload.csv?&webmasterId=501&startDay=02&startMonth=02
&startYear=2002&endDay=02&endMonth=07&endYear=2009&isRanged=false&symbol=IBM
Thanks and have a nica day,
Aad
Excellent work Samir!!
Quick question: is there any way to keep a formula that uses the database you pull from Yahoo. I mean, if I’m calculating the daily return on any symbol, I’d like to automatically re-calculate the return, without having to recreate the formula…right now, everything I putt the data from Yahoo using VBA, my formulas go “REF!”.
Thanks,
Martin
With VBA, you can programatically enter a formula (automatically after you update the sheets with new quotes). It’s pretty simple
Hey Samir,
Thanks for the GREAT post!
I just wanted to point out one thing.
In the code, you have:
Dim StartMonth, StartDay, StartYear, EndMonth, EndDay, EndYear As String
When you do that, EndYear is actually the only variable defined as a String.
The rest of the variables are actually initially defined as Variants.
So if you put:
Dim StartMonth, StartDay, StartYear, EndMonth, EndDay, EndYear As String
MsgBox TypeName(EndYear)
MsgBox TypeName(StartMonth)
If it is before you assign StartMonth to a string, it will return two different data types.
It doesnt matter much since you almost instantly assign StartMonth but if you have more complex scripts, you may run into problems.
Thanks for the tip!
Samir-
Love the worksheet. I’m not very good with VBAs and would love a summary of closing prices for each ticker on the Parameters page.
My issue is that the VBA runs so slowly that 25 tickers took 15 min to populate. Not sure if it is the indirect function or something else. Any thoughts on what to add to your VBA to automate this? I’m on a win7 64bit machine with 6GB ram and using Excel 2010
Example: starting in column J,
column J K L M N O P
Date ASCA BYD BYI DDE IGT ISLE Row 1
12/31/2010 15.63 10.6 42.19 3.4 17.69 10.22 Row 2
1/3/2011 15.52 10.81 43.02 3.46 17.99 10.45 Row 3
1/4/2011 15.5 10.72 42.59 3.45 17.96 10.08 Row 4
1/5/2011 15.79 11.65 42.9 3.48 18.61 10.4 Row 5
to get the dates I used: =IF(INDIRECT(“‘”&$A$11&”‘!A”&ROW(C3))=””,””,INDIRECT(“‘”&$A$11&”‘!A”&ROW(C3)))
and for the prices for ASCA in K1 I used:
=IFERROR(VLOOKUP($J2,INDIRECT(“‘”&K$1&”‘!$A$3:$E$2500″),5,0),””)
Thanks
Dear Samir,
It’s such a great work. If it is possible to have the same thing for multiple tickers for google finance data. You have it for single ticker for google finance but not as this one.
Please help.
Amitesh
Samir, the worksheet is great, exactly what we all need, in my case I am an amateur investor but as I am an engineer I really enjoy calculating ratios to compare possible investment options and different portfolios. In fact for matrix and correlation calculation your tool is incredible, it has solved all my problems to get data.
QUESTION:
I have searched some spanish stocks with the Stock ticker, i.e. TRE.MC and it works, however I did not have good luck with ETFs or funds, it simply might be due to the nomenclature used by yahoo finance or due to the funds I search for not being in their data base.
Could you give us some advise on how searching other products with their ticker, ISIN or in other ways if possible? If it were not possible, I suggest you could update your tool or create a new one for ISINs it would be really interesting for a full set of investors.
Hi Samir,
I was looking for a tool to download historic data and came across your site and I am impressed. Great work! I was trying to modify the code, but I’ve been unable to do so. Like others have said, is there a way to have tickers in Column A for a single date, rather than dates in Column A for a single ticker (as it is now)? Ideally, I would like to have the following format:
http://oi39.tinypic.com/2zr2mhe.jpg
Please let me know if you can help.
Thanks!
Tahleel
Just amazing work….Samir….Can I have the same thing. i.e. multiple stock downloader for google finance.
Amitesh
Hi Samir,
I have just one question:
How can I change this code, that I become date format like this: yyyy-mm-dd and the rows are sorted newest to oldest?
thank you
Hi Samir,
it’s everything very good, but I have just one question:
I want to become date formate like this: yyyy-mm-dd.
How can change this code?
thank you
Erik
I’ve just made this change! Download the updated spreadsheet
I would like to third Michael H adn Edward H’s request. That will be really helpful if the data can be combined into a single worksheet. I’m using Amibroker and this feature will be time saving.
Thank you for this awesome worksheet.
Hello Samir, I was hopeing you could help, I have no programing experiance and am looking for a way to download just the closing prices for a number of stocks everyday. I would like to be able to update the list the next day while saving the previous days and weeks information. All the while having it be one sheet.
thanks so much
Dennis
HI
Great work on this Samir. Can you tell how to amend the VBA code to look at UK shares please? I’m entering PFD for Premier Foods and I’m getting back Flaherty & Crumrine Income Fund from the NYSE.
Thanks in advanced.
This was excellent and very well done.
I wondered if you had code that puts the data into a single csv worksheet.
That is, instead of a sheet for each company, the data on one worksheet.
Or perhaps you have a tip for me to modify the code.
I want to download the entire S&P 500 and then suck the data into some analysis.
Anyway, you are great!
Try the updated worksheet at the bottom of the post, and the new “Collate” checkbox
The macro was just exactly what i have been looking for.
But i have encounter with a slight problem on this part
Sheets(stockTicker).Sort.SortFields.Add Key:=Range(“A3:A” & lastRow), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
It keep showing runtime error “438″.
I’m using MS Excel 2003.
Thank you
The spreadsheet runs fine on Excel 2010. Do you have access to this version?
It’s not working for me, once I put the stocks in, all of the other tabs disappear and none for the new stocks reappear
I’ve just tried the spreadsheet in Excel 2010 and it’s works for me. What version of Excel are you using?
After downloading the “Multiple Stock Quote Downloader with CSV Export and Collate Data.xlsm” file and opening it in Excel 2011 Mac, when I click on the “Get Bulk Quotes” button, it processes for a few seconds and then reports:
No Data for these Tickers
WMT
KKR
KO
…
Your “YahooStockQuotes.xlsm” works fine.
I’m not a VBA whiz, but have debugged C/C++ & Perl. So I’d be willing to do a couple of tests if it would help find the cause. Searching for “Error” got me noplace.
Do you have any suggestions?
Mac OSX 10.7.5, Excel.Mac 2011 v14.3.2
Thanks, Tony
PS If it works, I’ll donate:)!
Try this: https://investexcel.net/wp-content/uploads/2013/12/Multiple-Stock-Quote-Downloader-with-CSV-Export-and-Collate-Data-MAC-test.zip
Tell me if it works for you.
In an attempt to understand the VBA I’ve been comparing the original and the modified version (where worksheet data<Column H are preserved). I keep getting a recovery error when opening the file:
Removed Records: Sorting from /xl/worksheets/sheet2.xml part
Removed Records: Sorting from /xl/worksheets/sheet3.xml part
Removed Records: Sorting from /xl/worksheets/sheet4.xml part
Removed Records: Sorting from /xl/worksheets/sheet5.xml part
Removed Records: Sorting from /xl/worksheets/sheet6.xml part
Removed Records: Sorting from /xl/worksheets/sheet7.xml part
Removed Records: Sorting from /xl/worksheets/sheet8.xml part
Removed Records: Sorting from /xl/worksheets/sheet9.xml part
It doesn't appear to affect the workings if the repair is done, but I'm curious as to why this is occurring every time the file is opened (Excel 2010&2013). Any ideas please?
Hello Samir,
I have the same problem as JamesW. Is there a way to fix this? This error even doesn’t allow to save Excel file by clicking CTRL+S. I need to overwrite a files first and only then I am able to make savings.
Hope you can point how to fix this error.
Thanks
I think this is an Excel 2010 bug.
In the VBA, try changing….
=================
With Sheets(stockTicker).Sort
.SetRange Range(“A2:G” & lastRow)
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
==================
…to…
==================
With Sheets(stockTicker).Sort
.SetRange Range(“A2:G” & lastRow)
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
.SortFields.Clear
End With
=================
Samir,
I tried this for the Indian markets and it throws me an error.
Is there anything we need to change for the Indian markets?
Example : BHEL, Reliance, Infosys
Thanks,
Renju.S
Samir,
The spreadsheet worked OK over the last week; however, it suddenly stopped working Today (7/11/2013). It deletes all the tickers and does not recreates them only leaving the parameter sheet. I re-downloaded the spreadsheet from the website and ran it as you have it setup and it still deletes all the tickers and only leaves the parameter sheet. Please help.
I’ve just tried the spreadsheet, and it works fine for me. It also works with a new set of tickers.
Could you try again?
Dear Samir,
You have really done wonderful thing with such a depth of effort. I wish if you can make one more file where latest price of multiple companies can be downloaded into one sheet only based on the stock symbol in one column with various parameteres like LTP, Opening, Closing, Day high, Day low, 52 week high, 52 week low, All time high, all time low etc. etc.
Try the stock comparison spreadsheet at https://investexcel.net/2515/stock-comparison-spreadsheet/
Thanks Samir for coding such a gangster macro . . . . this is EXACTLY, I MEAN EXACTLY what I was looking for.
Karl7 – thanks for the MAC debugs! Equally appreciated.
Love it! 🙂
Thanks!
I have a major update in the works. The new version will calculate all sorts of technical trading indicators for your chosen ticker symbols. As ever, it’ll be free
Great job. Is there a way to remove Open, High, Low, etc. and only pull in the close price + Date? Thanks.
Dear Samir,
I am a regular user of your Multiple Stock Downloader which saves me a lot of time everyday. Congratulations for pulling out this awesome code, its has been a great companion!!
Well, It was working fine till today morning when i realized that the data is not showing up! I downloaded a fresh copy of your downloader and tried it on a different computer (I thought i might have screwed the Perfect VBA or I might have changed some Settings on My PC). But much to my surprise, it just dint work.
I tried compiling the VBA and it looked fyn until it comes back to the downloading part from Yahoo Finance where the data from yahoo is not getting downloaded into the new adjacent sheet, which then results in deletion of the sheet later leaving only the parameter sheet behind. I looked at the variable values too in the compiler and it was all fyn.
I tried your other Yahoo sheets as well and surprisingly none of them actually is able to download data from Yahoo. Something seems to have changed.
I request you to please look into the matter and give your valuable suggestions and solutions to the problem.
Thanks & Regards
Aditya Singh
Dear Samir,
Happy to say that there was no problem with the VBA…The fact that my Internet Explorer was set to offline was not allowing me to access web through web links in Excel.
Thanks & Regards
Aditya Singh
Good to know you got the problem sorted out. It’s always the simplest things 🙂
Dear Samir:
First and foremost, you do absolutely marvelous work on this site. You should be very proud of your achievements in this discipline. Being able to connect to these historical stock price databases allows the individual investor/trader to customize their own tech analysis indicators and to perform correlation studies on only the variables that interest that particular investor/trader. Excel gives us a lot of options and the freedom to personalize the data mining techniques that make the most sense to the user. GREAT WORK, SAMIR!!!!!! THANK YOU!!
Before I conclude, I do have a specific question. When I run the data downloader xlsm, I have no problems at all when I DO NOT select “csv” option. If, however, I do use the CSV option, I always get an error message that reads like this — msft 15-04-2012 – 04-09-2013 d.csv’ cannot be accessed. The file may be corrupted, located on a server that is not responding, or read-only. MSFT is the first stock on the list being downloaded. All of the separate worksheets are perfect, but the individual CSV files stop running after creating the first one, which is MSFT in this case. I’m not sure what to do next, Samir. I have tested this at least 15 times already and I get the same type of answer each and every time. I don’t know VBA, so if I can’t get this downloader xlsm to provide individual CSV files, I’ll just live with the data in separate worksheets.
Thank you very much, Samir. If you can’t easily provide me with something to try, please don’t worry about it. You do enough work already and I don’t want to create any more for you. Any thoughts or ideas would be greatly appreciated.
Take care, Samir.
Steve
Steve
I’ve just tried the spreadsheet on two laptops. CSV export works on both with no error.
I don’t know why you get that error. Permissions, or a virus checker preventing Excel from writing to the hard disk?
Samir
Samir:
Thanks for your suggestion. I will take a look at it. One final question. When you choose the CSV Export option, do you also get the data exported in individual worksheets as well? I tried 20 symbols and all 20 exported perfectly to the worksheets within your xlsm workbook. Then the first CSV file is created and then it stopped with the aforementioned “Error message” (see above).
Again, Samir, I thank you for the OUTSTANDING Excel work that you do. I sincerely appreciate the resulting files that you build so smartly.
Take care
Steve
Yes, I get the all the CSV files written to the appropriate location.
Samir
Amazing spreadsheet. Thanks a bunch.
Hi Samir,
Great spreadsheet. Thanks for making the VGA available to modify, which I managed to do in order to remove the dates from the filenames when saving. One thing I’m having a problem with is that it puts a blank line at the bottom of the file when it writes the CSV. If you are at the top of the file and hit END+DOWN ARROW, it goes to the line one past the last data item, which is a problem when I go to read it into another program. Is there a way to eliminate the extra blank line that is going in at the bottom of each data file? You can see this by comparing it with the Yahoo file that you save from the Historical Price download button on Yahoo, and hitting the END+DOWN ARROW. The file saved directly from Yahoo (Right click and SAVE AS) has no blank lines beneath the data. If you could tell me how to modify that I’d greatly appreciate it.
Thanks Samir, and great job!
Chris
Hey Samir,
If you do manage to look at my previous request, could you also take out the first line that says what the stock name is, since the filename identifies it, and my other program which needs to import the data needs the data to start on line 2 actually below the column heading titles.
Thanks so much!
Chris
Awesome work and thanks for the free version.
of the 300+ quotes I’ve used it for I found two that I couldn’t get the spreadsheet to retrieve
KEG-UN.TO http://finance.yahoo.com/q?s=KEG-UN.TO&ql=1
SRV-UN.TO http://finance.yahoo.com/q?s=SRV-UN.TO&ql=1
and these do appear to be correct as per finance.yahoo.com
an enhancement might be to notify the user that a ticker wasn’t found.
That’s a great idea. I’ll code this in
Download the latest version of the spreadsheet. I’ve just modified the VBA so you get a list of tickers for which no data was found.
Hi Samir!
Great job! I’m not smart with VBA, but I’d like to submit you a question. I’m trying to download some fundamental data from yahoo (i.e. “EPS Revisions – Up Last 7 Days”) but with scarce results. Do you think in your experience is it possible to reach this goal in a similar way you downloaded the quotes in this terrific spreadsheet? I mean a list of symbols in a column with correspondent data requested in the subsequent column? (I.e. AMD and then “2” for example…)
regards,
Frulo
Hi Samir.
Amazing spreadsheet, really a great job!
Dou you know if is it possible to work with brazilians stocks?
For instance, i have tried to get cotes from ETER3 and CRUZ 3 but it didn´t work.
Do you have any idea to help me?
Regards,
Francisco.
Don´t worry Samir.
I got the answer… The ticker was wrong.
ETER3.SA
CRUZ3.SA
and the spreadsheet works great!
Tks.
Great spreadsheet Samir! I use it almost everyday! I do have one questions for you. Is there a way to enter multiple stocks and specific date ranges for each stock? I would like to back test a handful of stocks with specific date ranges for each stock. Any help would be greatly appreciated!
Yes, there is a way. I don’t have the cycles to modify the VBA this right now (unfortunately InvestExcel.net doesn’t pay my bills and I have a job) but maybe in the future