https://github.com/datadiggerjay/serp-results_scrappig
The Google Sheets Search Query Processor automates fetching top Google search results for queries stored in a Google Sheet. It integrates SerpAPI for search results and Google Sheets API for data handling, ensuring seamless updates while skipping processed queries and unwanted domains.
https://github.com/datadiggerjay/serp-results_scrappig
api automation python serp serp-api web-scraping
Last synced: about 1 year ago
JSON representation
The Google Sheets Search Query Processor automates fetching top Google search results for queries stored in a Google Sheet. It integrates SerpAPI for search results and Google Sheets API for data handling, ensuring seamless updates while skipping processed queries and unwanted domains.
- Host: GitHub
- URL: https://github.com/datadiggerjay/serp-results_scrappig
- Owner: DataDiggerJay
- Created: 2025-02-03T12:09:41.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-04T13:18:05.000Z (over 1 year ago)
- Last Synced: 2025-06-20T12:49:42.364Z (about 1 year ago)
- Topics: api, automation, python, serp, serp-api, web-scraping
- Language: Python
- Homepage: https://github.com/DataDiggerJay/SERP-results_scrappig
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Google Sheets Search Query Processor
## 📖 Overview
This project automates the process of fetching top search results from Google based on search queries stored in a Google Sheet. It utilizes **SerpAPI** for search results and **Google Sheets API** for reading and writing data.
## 🚀 Features
- Reads search queries from a Google Sheet.
- Fetches top search results using **SerpAPI**.
- Stores the results in adjacent columns in the same sheet.
- Skips already processed rows and unwanted domains.
- Configurable to retrieve more than 2 results.
## 📋 Requirements
- Python 3.7+
- A **Google Cloud** service account with Sheets API enabled.
- A **SerpAPI** key.
## 📂 Installation
1. **Clone this repository**:
```sh
git clone https://github.com/DataDiggerJay/SERP-results_scrappig
cd your-repo
```
2. **Create a virtual environment (optional but recommended)**:
```sh
python -m venv venv
source venv/bin/activate # For Windows: venv\Scripts\activate
```
3. **Install dependencies**:
```sh
pip install -r requirements.txt
```
## 🔑 Setup
### **1. Enable Google Sheets API**
- Go to [Google Cloud Console](https://console.cloud.google.com/)
- Create a new project (or use an existing one).
- Enable **Google Sheets API** and **Google Drive API**.
- Create a **service account**, download the JSON key file, and place it in your project folder.
### **2. Share Your Google Sheet**
- Open your Google Sheet.
- Share it with the service account email found in the JSON file.
### **3. Get a SerpAPI Key**
- Sign up at [SerpAPI](https://serpapi.com/).
- Generate an API key and store it securely.
## ⚙️ Configuration
- Update the `script.py` script:
```python
SERP_API_KEY = "your_api_key_here" # Replace with your actual API key
```
- Update the Google Sheets credentials file path:
```python
creds = ServiceAccountCredentials.from_json_keyfile_name("path/to/your/credentials.json", scope)
```
- Modify `START_ROW` and `NUM_ROWS` to process specific rows in the sheet.
## 🏃♂️ Running the Script
Execute the script with:
```sh
python script.py
```
## 🛠️ Customization
### **To get more than 2 results**
Modify the `num_results` variable in `script.py`:
```python
num_results = 5 # Fetch 5 results instead of 2
```
Ensure your Google Sheet has enough columns to store additional results.
## 🤝 Contributing
Feel free to submit **pull requests** or open **issues** for improvements.
## 📜 License
This project is licensed under the **MIT License**.
## ✨ Author
[Jayesh Berde](https://github.com/DataDiggerJay)