VPC Static IP for Sheets Add-On for UrlFetchApp.fetch

Viewed 14

I have a Google Apps Script Project that is an "add-on" for Google Sheet.
It does a "get" through UrlFetchApp to retrieve some info through an API.

The company with the API requires a static IP (Mercury Bank), which has to be whitelisted on the Mercury website through 'settings'.

In GCP I created a Virtual Private Cloud with a subnet and a static IP.

When I run the code I get "Exception: Request failed for https://api.mercury.com returned code 401. Truncated server response: {"errors":{"message":"That token may not be used from the current IP Address, which is: 107.178.203.205"}} "

When I run it again I get the same error, but with a different IP.

How do I tell Google Cloud to run the apps script using the static IP?

THANKS!

0 Answers
Related