This project is a Node.js application that accesses a Google Spreadsheet.
- Node.js installed on your machine
- Google account
- Clone this repository to your local machine.
- Run
npm install
to install all necessary dependencies.
To access Google Spreadsheet, you need to authenticate your application. Follow these steps to create a service account:
- Go to the Google Cloud Console.
- Create a new project or select an existing one.
- In the sidebar, navigate to "APIs & Services" > "Credentials".
- Click on "+ CREATE CREDENTIALS" and select "Service account".
- Fill in the details for the service account (name, description, etc.).
- Click "CREATE" and "CONTINUE" until you get to the "Grant this service account access to project" page.
- From the "Role" dropdown, select "Project" > "Editor".
- Click "CONTINUE" and then "DONE".
- In the list of service accounts, find the one you just created and click on the email.
- In the "Keys" section, click "ADD KEY" and select "JSON".
- A JSON key file will be downloaded. Keep this file secure and do not share it publicly.
- Rename the downloaded JSON file to
google-auth.json
and move it to the private directory of this project. - In your Google Spreadsheet, click "Share" and share it with the email found in your
google-auth.json
file.
After setting up the service account, you need to enable the Google Sheets API for your project. Follow these steps:
- In the Google Cloud Console, make sure you have selected the correct project for which you created the service account.
- In the sidebar, navigate to "APIs & Services" > "Library".
- In the search bar, type "Google Sheets API" and select it from the dropdown list.
- Click "ENABLE".
Now, your application has access to the Google Sheets API using the service account.
Run node index.js
to start the application.
This project is licensed under the MIT License - see the LICENSE.md file for details.