Pull Stock Data & Export It To Excel Using Python
A short video walkthrough: pull share price history in Python and write it straight out to Excel. There is no written guide on this page, only the video.
For the same thing written out step by step, with the code and the pandas DataReader setup, see How to Get Stock Data and Export It To Excel Using Python.
A quick way to pull stock data using Python
import pandas_datareader as web
from datetime import datetime
import pandas as pd
start = datetime(2020,1,1)
end = datetime(2021,2,28)
ticker = 'TSLA'
df = web.DataReader(ticker,
'yahoo',
start,
end)
df.to_excel('stockdata.xlsx')