This script scrapes business details from Google Maps using Playwright and stores the extracted data in Excel and CSV formats.
- Automates Google Maps search for businesses.
- Extracts details such as name, address, website, phone number, reviews average, and coordinates.
- Saves the data in both Excel and CSV formats.
- Supports batch search via
input.txt.
- Python 3.7+
- Playwright
- Pandas
- Clone the repository or download the script.
- Install dependencies:
pip install playwright pandas playwright install
python script.py -s "Restaurants in New York" -t 50- Create a file named
input.txtand list search queries (one per line). - Run the script without arguments:
python script.py
-s,--search: Search query (e.g., "Hotels in Los Angeles").-t,--total: Maximum number of results to scrape.
The extracted data is saved in the output directory as:
google_maps_data_<search_query>.xlsxgoogle_maps_data_<search_query>.csv
- If
-sis not provided andinput.txtis empty, an error message will be displayed. - If scraping fails for a business, the script continues to the next one.
MIT License
andrepradika