There are two main ways to obtain a credential JSON file for your Google Spreadsheet:
1. Using the Google Cloud Console:
- Go to the Google Cloud Console (https://console.cloud.google.com/).
- If you don’t have a Google Cloud account, create one.
- Once logged in, navigate to the APIs & Services section.
- Search for Google Sheets API and enable it.
- Create a new Service Account by clicking on Create Credentials → Service Account.
- Give your service account a name and choose a role. For most use cases, the Sheets Editor role should be sufficient.
- Click Create.
- On the next screen, you’ll see a JSON key file download button. Click on it to download the credential JSON file.
2. Using the Google Sheets API Explorer:
- Go to the Google Sheets API Explorer (https://developers.google.com/sheets/api/quickstart/python).
- Follow the instructions on the page to create a new project and enable the Sheets API.
- Click on Authorize and choose a New Client ID.
- Select Web Application as the application type and give it a name.
- Click Create.
- You’ll be redirected to a page with a client ID and client secret.
- Download the credential JSON file using the provided link.