Getting Stock Information into Excel

Written by Allen Wyatt (last updated July 19, 2022)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365


6

For years Jack has used the Yahoo! Finance API to import stock information into his worksheets. Now that service has gone away. Jack figures he can't be alone in needing to get stock information into his Excel worksheets, so he is wondering if there other services that folks with similar needs can suggest.

There are a few ways that the loss of the Yahoo! Finance data could be approached. If you need just current prices, one approach is to rely on Google Sheets where you can use the GoogleFinance function to get a number of financial statistics. Once they are in a Sheets worksheet, you can then copy and paste them into your Excel worksheet.

There are also other sites that provide data and include an API. You might need to write your own code to access the data through the API, but it is available. Here are two sites to check out:

https://www.alphavantage.co/
https://www.quandl.com/

If you poke around on the sites, you may find that some data is offered in Excel format, as well.

One subscriber suggested the following site as a possibility:

http://investexcel.net/multiple-stock-quote-downloader-for-excel/

You may want to poke around in the comments on the page, as some seem to indicate some trouble in getting the financial information they desired.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (5223) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Rejecting Changes in a Document

When a group of people edits a document with Track Changes turned on, it can be tempting for one of the editors to use ...

Discover More

Protecting Many Worksheets

Need to protect a lot of worksheets? Rather than protect the sheets individually, you'll appreciate the macros discussed ...

Discover More

Printing a Screen without the Print Screen Key

The Print Screen key is a handy way to grab a screen shot. What if your keyboard doesn't physically have such a key, ...

Discover More

Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!

More ExcelTips (ribbon)

Problems Pasting Information into a Worksheet

What do you do if pasting information into a worksheet brings Excel to its knees? This tip looks at just a few ideas you ...

Discover More

Using More CPU Power when Calculating

Today's PCs are more powerful than ever, but you can still have slowdowns when it comes to calculating large workbooks. ...

Discover More

Changing the Outline Color of the Selected Cell

It can be a bit difficult, at times, to locate the selected cell on the screen. If you have difficulties in this area, ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is two less than 9?

2024-02-26 07:45:39

Hans Hallebeek

I get very upset by the way others set up their workbooks.
To avoid these annoyances I have set my default excel settings in my personal macro book, in a sheet I set my default settings:
Formula visibility
Grid visibility
Application window size
Zoom
Etc
These settings are executed when the personal macro book is opened and in the workbook before close event
When another workbook has other settings these will temporarily apply until it’s closed


2024-02-22 17:53:54

Tomek

Further to my earlier comments, it is likely Windows that remembers sizes of various program windows, not specifically Excel.
The end result is the same though.


2024-02-19 15:57:42

J. Woolley

To specify the position and size of each workbook when it is opened, including a new workbook, put this code in the ThisWorkbook module of Personal.xlsb or an Excel add-in file (.xlam). If the workbook's window is Normal (not Maximum or Minimum), this code positions its top-left corner at (450,0) pixels and its bottom-right corner at (1650,1040) pixels; adjust those values as required.
This code runs automatically; it is not a macro requiring manual activation.

Private WithEvents App As Application 'locate before procedures

Private Sub Workbook_Open()
Set App = Application
End Sub

Private Sub App_NewWorkbook(ByVal Wb As Workbook)
App_WorkbookOpen Wb
End Sub

Private Sub App_WorkbookOpen(ByVal Wb As Workbook)
Const PtPerPx As Single = 72 / 96 'points/pixel
With Application
If .WindowState = xlNormal Then
.Left = PtPerPx * 450
.Top = PtPerPx * 0
.Width = PtPerPx * 1200
.Height = PtPerPx * 1040
End If
End With
End Sub

Private Sub App_WorkbookDeactivate(ByVal Wb As Workbook)
With Application
If .Workbooks.Count = 1 Then 'last workbook closed
.Visible = False
.Quit
End If
End With
End Sub

See https://sites.google.com/view/MyExcelToolbox


2024-02-18 15:24:14

Tomek

What I said in my earlier comment applies to the window position too.


2024-02-18 15:22:29

Tomek

Excel seems to remember the size of its window when you last closed it. Any next session will automatically start with this size of the window, whether you just start a new session with the default blank workbook, use a template or open an existing file. This size can be probably modified by a Before_Close macro.

There is an exception to that if you use a shortcut somewhere (Desktop, in the file explorer, in the start menu, on the taskbar, etc), in which it is specified to run the program in a maximized window. In such case the program will always open with the window maximized.
Also, if the last session you closed was in maximized window, and the shortcut specifies normal window, it will still open in maximized window as this is the last remembered one and it becomes a new normal.

The shortcut can point to the Excel program itself, or to any Excel files or templates. It could also point to another shortcut, but I did not check setting of which takes precedence.


2024-02-17 11:21:54

Brian Lair

This is one of the very few things that aggravate me about Excel — its seemingly random sizing and placement of windows when creating or opening workbooks. Long ago, I created a macro similar to your CNWkBk2 and put a button for it on the Quick Access bar. I’ve just gotten into the habit of clicking that button every time.


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.