Previous configuration
In console.cloud.google.com:
You must choose a project or create a new one:
The google drive API must be enabled, we can look for it in the "library" section.
Once enabled, in the credentials section, we must create a password for our service account:
A json file will be downloaded, once this is done the next thing will be to enable the google sheets API.
Once enabled, the last part will be to share the google sheets document with the project service account, the address is in the previously downloaded json: