How to Download ESG Ratings Data from Yahoo Finance Using Excel

How to Download ESG Ratings Data from Yahoo Finance Using Excel

Ethical Society Governance (ESG) ratings are a critical component in the modern investment decision-making process. They offer investors insights into a company's environmental, social, and governance performance. Yahoo Finance is a popular platform to access these ratings. In this article, we will guide you through the steps to download this data using Microsoft Excel, making use of its built-in capabilities and a bit of programming expertise.

Step-by-Step Guide to Downloading ESG Ratings Data

1. Connecting Excel to Yahoo Finance

Excel's Data - Import External Data feature can directly connect to Yahoo Finance and import the relevant ESG ratings data into your Excel spreadsheet. Here's how:

Access Excel Data - Get Data: Open your Excel workbook and go to the Data tab, then click on Get Data. Select Data Source: In the window that appears, select Web. This will open a new window. Enter URL: In the URL input field, enter the specific Yahoo Finance page where the ESG ratings are displayed. You can find this URL by looking at the address bar in your web browser. Choose Data to Import: Select which data you want to import. Typically, you would choose the table that contains the ESG ratings. Load Data: Once you've selected the data, click Load to import the data into your Excel workbook.

2. Automating the Process for Multiple Pages

While the above method allows you to import data from a single page, if you need to gather data from multiple pages, you can use M language (Power Query), which is built into Excel. M language provides a robust way to write scripts that can handle complex data operations.

Start Power Query: After loading the initial dataset, click on the Manage Queries button and select Transform Data to open Power Query. Write M Code: In the Power Query Editor, you can write M code to loop through multiple pages. Here is a simplified example of what that might look like:
M Code Example:let    Page  1,    TotalPages  10,    url  "~refined-asx-3-properties-structures-20231026093121~etfrating-20231026093121",    AddPagesToUrl  (page as number) > Text.Lower(({url, "page", (page)})),    GetPageData  (url as text) > ((url)),    ImportData  (page as number) > let         sourceTable  GetPageData(AddPagesToUrl(page)),        data  Table.Buffer((sourceTable, {"#value"})) in         data,    AllData  ((List.Distinct(List.Range(Page, TotalPages   1)), ImportData)),    AddToWorkbook  ({AllData}),    Result  AddToWorkbookin    Result

Note: This is a simplified example and may require adjustments based on the exact structure of the data on Yahoo Finance. Additionally, ensure you respect Yahoo Finance's terms of service before automating data imports.

Conclusion

Downloading ESG ratings from Yahoo Finance via Excel is an efficient way to gather and analyze important financial data. Whether you're a novice or a seasoned Excel user, the methods outlined in this article will help you manage and process your data successfully. By customizing scripts using M language, you can automate the process for multiple pages, saving you time and effort. Always ensure you have the necessary permissions and adhere to data usage guidelines to avoid any potential issues.