TLDR: Use Google Cloud project developer console to generate an API key restricted to Sheets API. Make your Google Sheet visible to anyone with the link.
- Go to Google Cloud console and select your project, or create a new one
- In
APIs & Services
, enable theGoogle Sheets API
- In
APIs & Services > Credentials
, generate new API key. It's a good practice to restrict that key, so restrict it to Google Sheets API you just enabled. - Voilà, you just got yourself an API key. 🎉
- Finally, you need to be able to access your Google Sheet using this API key. The easiest way to do that is to make your Google Spreadsheet accessible publicly for reading to anyone with the link.