Web Scraping Company Financial Statements To Excel For Financial Analysis Using Python

preview_player
Показать описание
In this tutorial, I will showing how to scrape a company's financial statements to an Excel spreadsheets using Python.

Couple advantages using a Python script to import a company's financial statement information to Excel:
📑 You can quickly import financial statements (balance sheet, income statement, statement of cash flow, accounting report, etc) for multiple companies.
📑 The output will be user friendly for financial statement analysis.
📑 If somehow you mess up the source data you can simply re-import the data again.

Before starting the tutorial, makes sure you install BeautifulSoup, pandas, and requests libraries.

Run the commands to install the libraries
----------------------------------------------------------------------
- pip install requests
- pip install beautifulsoup4
- pip install pandas

Buy Me a Coffee? Your support is much appreciated!
-------------------------------------------------------------------------------------
🔑Venmo: @Jie-Jenn

Support my channel so I can continue making free contents
---------------------------------------------------------------------------------------------------------------

#WebScraping #StockAnalysis #FinancialStatement #FinancialAnalysis
Рекомендации по теме
Комментарии
Автор

Hi all for those that got the error "ValueError: No tables found" please input the following:
df = pd.read_html(str(soup), attrs={'data-test': 'financials'})[0]
websites changes their code all the time so go to the financial table, right click "inspect", and find the whole table you will find that currently it will be under 'data-test' = financials
07/18/2023

Gaat
Автор

Looks like the website changes the id key from "fintable" to "data-test".

Last update: 2023-02-24

jiejenn
Автор

Great video. Just a heads up you left "aapl" hard coded in your ratio URLs. Those need to be changed to {ticker}.

DonovanBrown
Автор

Great video Jie Jenn. It would be very useful if you can create a video on how to webscrape financial statements from tradingview as well as it covers international stocks and not just US stocks. Thanks!

oscarlam
Автор

Great tutorial.!! I have a question.. I would like to know how import data to google sheet in cells that are already filled by other data. ??

I'm trying to automate my stocks imported financial data (income statement, balance sheet, cash flow statement) but I'm only able to import one by one because google sheet cells are already filled by the first stock data I imported.!
For example if the income statement data I imported fill cells B2:F57; if I want to import financial data of a second stock ticker, I wouldn't able because cells are already filled by the first stock ticker data.

How Can I RESOLVE This Issue.??


Thanks

moneymaker
Автор

Thanks for the video. Now that the table is a java script one how do we find the url for quarterly period and other filters?

hareeshch
Автор

I wonder why it gives me first table only. Code looks exactly the same. When I remove income url then it gives me balance sheet. Strange.

Lucas-beth
Автор

i didn't understand the part you wrote about headers . what is it about?

krumzy
Автор

hi, do you know how to write this to an existing excel spread sheet? This is super convenient but I already have 1 spreadsheet with my valuation model, so I gotta do one extra step of copying everything to my valuation spreadsheet. Thank you.

kidze
Автор

Hi Jie Jenn! Great video, helped me a lot.
A small issue that I had is that it is not taking quarterly data (I noticed that the url also does not change). Do you have any ideas on how to fix this? Appreciate any hints. Thanks!

luisguilhermeresende
Автор

Hello, you made a nice video. I have a doubt hope you will clear it. So I want to download DEF14A of all the companies for a certain year and I am kind of new to python. SO I have a doubt on how to use python, can you help me to tell me where should I change the codes. Thank you

shamitmanohar
Автор

It seems that the website implements an anti-scraping technic. I could only scrap less than 15 tickers at one time.

张铁耀-ef
Автор

Hello buddy please update the code attrs={'class': 'fintbl'}, they changed the class name and no more with id. Peace

ghazouaniahmed
Автор

how to do it for a list of stocks read all the company names from excel and write only the latest financials in the same excel book

parthpandya
Автор

Wich package autocomplete you used here

ameurchabane
Автор

Is it possible to have your own database of these excel sheets and a code running as a screener? Ideally would want the database to update as new quarterly data comes out

deepsudeep
Автор

please develop code for scraping morningstar financial

alvinleongcw
Автор

Hi Jie Jenn, thanks for the video! When I try and run this I get the following error:

ValueError: No tables found

Do you know what could be causing this? Thanks!

siesta
Автор

I could swear I wrote something, but it isn't in the comments... I tried your code, but the quarterly data url returns annual data. Any suggestions?

grob
Автор

Hi, thanks a lot. Actually, I can not even install the libraries.

af.a.fe.