Tuesday, August 23, 2022

List all GCP regions with Google (unofficial) API endpoint

I have several scenarios where I needed to list all GCP regions. (e.g. Cloud Billing API https://cloud.google.com/billing/docs/reference/rest).

I was surprised that there is no API for that. 

When you try to search "list of GCP regions" you will end with one of the top results to documentation e.g. https://cloud.google.com/compute/docs/regions-zones or https://cloud.google.com/about/locations. It is not suitable for programmatic access.

I have found recently an endpoint (not API!) with the list of IP ranges for each GCP regions


That was the last piece of the puzzle to create my desired function.

Here is a snippet for Google Apps Script:

Friday, February 25, 2022

Get filtered rows in Google Sheets with Google Apps Script

Google Sheets allows you to filter data in grid.

Sometimes you need to filter and use data with API.

 Google Sheets API has endpoint with array rowMetadata.

You can iterate over the all rows and check if property hiddenByFilter is setup.

Here is a snippet how to get filtered rows with Google Apps Script