Forum Discussion

Sam_S007's avatar
Sam_S007
Copper Contributor
Jun 12, 2020
Solved

Historical Stock Prices into Excel from Yahoo! Finance

I am using Power Query to automatically download historical stock price data from Yahoo! Finance into Excel.  The URL is https://finance.yahoo.com/quote/QQQ/history/

 

It populates a worksheet with a year's worth of stock prices with the following columns: Date/Open/High/Low/Close/Adj Close/Volume.

 

When I try to build a simple line chart using the data, the price column data is not recognized. So the Y-axis of the chart returns no values. I changed the format of the columns to "Number" but it doesn't make any difference. 

 

Does anyone have any solutions or workarounds. I attached a copy of the spreadsheet.

  • Sam_S007 

    Sure, just open the query on editing, find Change Type step, stay on it, select proper column and apply Decimal Number format, close the query.

     

    I did that in attached file.

5 Replies

  • SergeiBaklan's avatar
    SergeiBaklan
    Diamond Contributor

    Sam_S007 

    That's since all data returned is texts

    = Table.TransformColumnTypes(Data2,{{"Date", type date}, {"Open", type text}, {"High", type text}, {"Low", type text}, {"Close*", type text}, {"Adj Close**", type text}, {"Volume", type text}})

    Please change in Power Query on decimal numbers where applicable.

    • Sam_S007's avatar
      Sam_S007
      Copper Contributor

      SergeiBaklan 

       

      Just wondering why the first column (the Date column) is recognized properly as a date column while the other 6 columns are only recognized as text?  Is there any way to change the format of the price columns from text to numbers without VBA or any programming?

       

      Thanks!

      • SergeiBaklan's avatar
        SergeiBaklan
        Diamond Contributor

        Sam_S007 

        Sure, just open the query on editing, find Change Type step, stay on it, select proper column and apply Decimal Number format, close the query.

         

        I did that in attached file.

Resources