This can be a approach to write to a google sheet from Azure Data Factory.
First, securely store your Google API credentials in Azure Key Vault. Go to the Key Vault in the Azure portal, open the Secrets section, and add googleclientid
, googleclientsecret
, and googlerefreshtoken
as individual secrets. These will later be retrieved by ADF to authenticate with the Google Sheets API.
Next, grant ADF access to these secrets. In Key Vault, go to Access Configuration, ensure Access policies are enabled, and add a new access policy. Assign the "Get" permission for secrets to ADF’s managed identity.
In Azure Data Factory, create a pipeline and add Web Activity for each secret to get the secrets for you.
Then add a Web activity named GetAccessToken
. This activity sends a POST request to https://oauth2.googleapis.com/token
. In the request body, use dynamic content to insert the secrets from previous activity, and set grant_type
to refresh_token
to retrieve a fresh access token.
Create a pipeline variable access_token
and add Set Variable activity to get the output value @activity('GetAccessTokens').output.access_token
At last add a web activity, which write to sheet using POST
method and
add headers as
Authorization
: Bearer @{variables('access_token')}
.
Here is how the pipeline is designed:
Note: I will be not able to show a workable output as I do not have required secrets/ids for google APIs.
You can follow this document for more details