🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

nodejs-automation

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nodejs-automation

This Node.js package allows you to search for places using the Google Maps Places API and export the search results to an Excel file. It's useful for quickly gathering information about various places based on keywords and locations.

1.0.2
latest
npm
Version published
Weekly downloads
3
-76.92%
Maintainers
1
Weekly downloads
 
Created
Source

Google Places Search and Export to Excel

This Node.js package allows you to search for places using the Google Maps Places API and export the search results to an Excel file. It's useful for quickly gathering information about various places based on keywords and locations.

Features

  • Search for places using a keyword and city name.
  • Retrieve detailed information such as name, address, rating, reviews, and phone number for the top 20 results.
  • Export the search results to an Excel file for easy reporting and sharing.
  • Handles API rate-limiting with delays between requests.

Installation

To use this package, you need to have Node.js installed. You can then install the package via npm:

npm i nodejs-automation

Prerequisites

You need a valid Google Maps API Key to use the Google Maps Places API. Set up your API key in a .env file.

Create a .env file in the root of your project with the following content:

GOOGLE_MAPS_API_KEY=your_google_maps_api_key

Replace your_google_maps_api_key with your actual API key.

Usage

Programmatic Usage

You can use the package in your code like this:

const main = require('nodejs-automation');

const keyword = 'restaurants';
const city = 'New York';

main(keyword, city);

Output

The search results will be saved as an Excel file named <keyword>_in_<city>.xlsx in the current directory.

For example, if you search for restaurants in New York, the file will be named restaurants_in_new_york.xlsx.

API Details

The package uses the following Google Maps APIs:

  • Text Search API: To search for places based on a keyword and location.
  • Place Details API: To fetch detailed information about each place.

Error Handling

  • If no results are found for a search, the script will attempt a broader search.
  • Any API errors or issues are logged to the console.

Rate Limiting

To avoid exceeding API rate limits, the script adds a 1-second delay between requests for place details.

Example Output

Example data for a search result:

NameAddressDescriptionRatingReviewsPhone
Example Restaurant123 Main St, New York, NYOPERATIONAL4.5120+1-234-567-8900

How to Contribute

Contributions are welcome! Feel free to open an issue or submit a pull request with improvements or bug fixes.

License

This package is licensed under the MIT License.

Support

If you encounter any issues or have questions, feel free to open an issue on the GitHub repository.

Disclaimer

This package uses the Google Maps API, and you are responsible for any associated costs or compliance with the Google Maps Platform Terms of Service.

FAQs

Package last updated on 02 May 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts