Search code examples
google-sheetsgoogle-cloud-platformgoogle-sheets-apiapi-keysecret-key

Google Sheets API Browser Quickstart Client ID and API key


I am trying to follow the Browser Quickstart for the Google Sheets API. In "Step 1: Turn on the Google Sheets API", the tutorial has buttons which create a new project and create an API key, but I can't use these because I don't have permission to create new projects (however, I do have "owner" role for an existing GCP project). The tutorial provides no explanation of how to get a Client ID and API key without the use of the embedded buttons - how can I do this?


Solution

  • If you already have a existing project. You can add the Sheet API to it and then retrieve the credentials from said project.

    First enter Console Cloud. In there select the project where you need to enable the API calls.

    enter image description here


    enter image description here

    After you have selected your project you need to enable the API for this project, to do so go to the API dashboard. In there click on ENABLE APIS AND SERVICES:

    enter image description here

    In there look for the Google Sheets API and on founding it click on ENABLE:

    After enabing this API you will need to generate the credentials click on Create credentials > OAuth client ID. After that you just need to fill the information and add the corresponding scopes.

    After you have added your credentials you can download the JSON for you to use it.

    enter image description here


    For the API key you can do the same process but instead of OAuth Client ID do Create credentials > API key:

    API Key creation

    After that you can see the API Key from the same page.

    If you need more information on how to enable API's and other functionalities refer to the official documentation.