|
1 | | -# Web to Excel Data Automation |
2 | | - |
3 | | -This Python project demonstrates how to extract a numeric value from a webpage using `requests` and `BeautifulSoup`, process it, and then write the result to a specific cell in an Excel file using `openpyxl`. |
4 | | - |
5 | | -It is ideal for automating tasks like tracking online financial or statistical data and recording it directly into Excel spreadsheets. |
6 | | - |
7 | | ---- |
8 | | - |
9 | | -## 📌 Features |
10 | | - |
11 | | -- Fetches numerical data from a webpage. |
12 | | -- Parses HTML tables and extracts values. |
13 | | -- Converts annual values to monthly averages (customizable). |
14 | | -- Writes the result into a specified Excel cell. |
15 | | - |
16 | | ---- |
17 | | - |
18 | | -## 🚀 Requirements |
19 | | - |
20 | | -Install required Python packages: |
21 | | - |
22 | | -```bash |
23 | | -pip install requests beautifulsoup4 openpyxl |
24 | | -📂 File Structure |
25 | | -bash |
26 | | - |
27 | | -project-folder/ |
28 | | -├── web_to_excel.py # Main script file |
29 | | -└── README.md # Documentation |
30 | | -🧩 How to Use |
31 | | -Update the script: |
32 | | - |
33 | | -In the web_to_excel.py file, locate this line: |
34 | | - |
35 | | -python |
36 | | - |
37 | | -url = "ENTER_THE_WEBPAGE_URL_TO_SCRAPE" |
38 | | -Replace it with the actual URL of the website you want to scrape data from. |
39 | | - |
40 | | -Customize HTML parsing logic |
41 | | -If the structure of the table is different, update the parsing logic accordingly. |
42 | | - |
43 | | -Set your Excel file path and sheet name: |
44 | | - |
45 | | -python |
46 | | - |
47 | | -file_path = r"PATH_TO_YOUR_EXCEL_FILE.xlsx" |
48 | | -sheet_name = "YourSheetName" |
49 | | -Run the script: |
50 | | - |
51 | | -bash |
52 | | - |
53 | | -python web_to_excel.py |
54 | | -⚠️ Notes |
55 | | -Make sure the Excel file is closed before running the script. |
56 | | - |
57 | | -If the webpage structure changes, the script may need to be updated. |
58 | | - |
59 | | -This example assumes the target data is inside the first HTML table. |
60 | | - |
61 | | -📄 License |
62 | | -MIT License |
63 | | -You are free to use, modify, and distribute this code with attribution. |
64 | | - |
65 | | -© 2025 Data Solutions Lab. by Osman Uluhan – All rights reserved. |
| 1 | +# Web to Excel Data Automation |
| 2 | + |
| 3 | +This Python project demonstrates how to extract a numeric value from a webpage using `requests` and `BeautifulSoup`, process it, and then write the result to a specific cell in an Excel file using `openpyxl`. |
| 4 | + |
| 5 | +It is ideal for automating tasks like tracking online financial or statistical data and recording it directly into Excel spreadsheets. |
| 6 | + |
| 7 | +--- |
| 8 | + |
| 9 | +## 📌 Features |
| 10 | + |
| 11 | +- Fetches numerical data from a webpage. |
| 12 | +- Parses HTML tables and extracts values. |
| 13 | +- Converts annual values to monthly averages (customizable). |
| 14 | +- Writes the result into a specified Excel cell. |
| 15 | + |
| 16 | +--- |
| 17 | + |
| 18 | +## 🚀 Requirements |
| 19 | + |
| 20 | +Install required Python packages: |
| 21 | + |
| 22 | +```bash |
| 23 | +pip install requests beautifulsoup4 openpyxl |
| 24 | +📂 File Structure |
| 25 | +bash |
| 26 | +Kodu kopyala |
| 27 | +project-folder/ |
| 28 | +├── web_to_excel.py # Main script file |
| 29 | +└── README.md # Documentation |
| 30 | +🧩 How to Use |
| 31 | +Update the script: |
| 32 | + |
| 33 | +In the web_to_excel.py file, go to the following line: |
| 34 | + |
| 35 | +python |
| 36 | +Kodu kopyala |
| 37 | +url = "ENTER_THE_WEBPAGE_URL_TO_SCRAPE" |
| 38 | +Replace it with the actual URL of the website you want to scrape data from. |
| 39 | + |
| 40 | +Customize HTML parsing logic |
| 41 | +If the structure of the table is different, you may need to update how the table is parsed using BeautifulSoup. |
| 42 | + |
| 43 | +Set the correct Excel path and sheet name: |
| 44 | + |
| 45 | +Update the following section with your file path and sheet name: |
| 46 | + |
| 47 | +python |
| 48 | +Kodu kopyala |
| 49 | +file_path = r"PATH_TO_YOUR_EXCEL_FILE.xlsx" |
| 50 | +sheet_name = "YourSheetName" |
| 51 | +Run the script: |
| 52 | + |
| 53 | +bash |
| 54 | +Kodu kopyala |
| 55 | +python web_to_excel.py |
| 56 | +⚠️ Notes |
| 57 | +Ensure the Excel file is closed before running the script. |
| 58 | + |
| 59 | +This script assumes that the target data is in the first HTML table of the page. |
| 60 | + |
| 61 | +The numeric format uses commas (,) for decimals. If your data uses dots (.), you may adjust the conversion logic. |
| 62 | + |
| 63 | +📄 License |
| 64 | +MIT License |
| 65 | +You are free to use, modify, and distribute this code with attribution. |
| 66 | + |
| 67 | +© 2025 Data Solutions Lab. by Osman Uluhan – All rights reserved. |
0 commit comments