How to Get Stock Data & Export It To Excel Using Python
Language:
In this tutorial, I will show you, how you can retrieve Stock information and export it to Excel by using Python with the help of the pandas datareader library.
import pandas_datareader as web from datetime import datetime import pandas as pd start = datetime(2020,1,1) end = datetime(2020,7,31) stock = ['GOOG','TSLA','MMM'] df = web.DataReader(stock,'yahoo',start,end) df.to_excel(f'stockdata_{stock}.xlsx')