Extract and Upload Wikipedia Table Data to Google Sheets Using Python

Learn how to extract GDP data of Indian states from Wikipedia, process it using Python and Pandas, and upload it to Google Sheets using Google Sheets API.

AUTOMATION

Rahul Singh

3/31/20251 min read

In today's data-driven world, automation plays a crucial role in streamlining data collection and reporting. This guide will walk you through how to extract Indian states' GDP data from Wikipedia and automatically upload it to Google Sheets using Python.

Prerequisites

Before getting started, ensure you have the following installed:

  • Python 3

  • Required libraries: requests, pandas, gspread, beautifulsoup4, oauth2client

  • A Google Service Account with API access to Google Sheets

Step 1: Extracting GDP Data from Wikipedia

We will use requests and BeautifulSoup to scrape the GDP table from Wikipedia and pandas to clean and format the data.