google sheets sink Google Sheets Sink

Provided by: "Apache Software Foundation"

Support Level for this Kamelet is: "Stable"

Send data to Google Sheets and update/append values on a spreadsheet.

Configuration Options

The following table summarizes the configuration options available for the google-sheets-sink Kamelet:

Property Name Description Type Default Example

accessToken

Access Token

Required OAuth 2 access token for google sheets application. This typically expires after an hour so refreshToken is recommended for long term usage.

string

clientId

Client Id

Required Client ID of the sheets application.

string

clientSecret

Client Secret

Required Client Secret of the sheets application.

string

refreshToken

Refresh Token

Required OAuth 2 refresh token for google sheets application. Using this, the Google Calendar component can obtain a new accessToken whenever the current one expires - a necessity if the application is long-lived.

string

spreadsheetId

Spreadsheet ID

Required The Spreadsheet ID to be used as identifier.

string

applicationName

Application Name

Google Sheets application name.

string

columnNames

Column Names

Optional custom column names that map to cell coordinates based on their position.

string

A

majorDimension

Major Dimension

Specifies the major dimension that the given values should use (ROWS or COLUMNS).

Enum values:

* COLUMNS * ROWS

string

ROWS

ROWS

operation

Operation Mode

Operation to execute (update or append).

Enum values:

* update * append

string

append

append

range

Cells Range

The cell range of rows and columns to write data to.

string

A1:B3

valueInputOption

Value Input Option

Controls how the entered values should be be interpreted when adding them.

Enum values:

* USER_ENTERED * RAW

string

USER_ENTERED

USER_ENTERED

Dependencies

At runtime, the google-sheets-sink Kamelet relies upon the presence of the following dependencies:

  • mvn:org.apache.camel.kamelets:camel-kamelets-utils:4.4.4-SNAPSHOT

  • camel:core

  • camel:jackson

  • camel:kamelet

  • camel:google-sheets

Camel JBang usage

Prerequisites

  • You’ve installed JBang.

  • You have executed the following command:

jbang app install camel@apache/camel

Supposing you have a file named route.yaml with this content:

- route:
    from:
      uri: "kamelet:timer-source"
      parameters:
        period: 10000
        message: 'test'
      steps:
        - to:
            uri: "kamelet:log-sink"

You can now run it directly through the following command

camel run route.yaml

Camel K Environment Usage

This section describes how you can use the google-sheets-sink.

Knative sink

You can use the google-sheets-sink Kamelet as a Knative sink by binding it to a Knative object.

google-sheets-sink-pipe.yaml
apiVersion: camel.apache.org/v1
kind: Pipe
metadata:
  name: google-sheets-sink-pipe
spec:
  source:
    ref:
      kind: Channel
      apiVersion: messaging.knative.dev/v1
      name: mychannel
  sink:
    ref:
      kind: Kamelet
      apiVersion: camel.apache.org/v1
      name: google-sheets-sink
    properties:
      accessToken: The Access Token
      clientId: The Client Id
      clientSecret: The Client Secret
      refreshToken: The Refresh Token
      spreadsheetId: The Spreadsheet ID

Prerequisite

You have Camel K installed on the cluster.

Procedure for using the cluster CLI

  1. Save the google-sheets-sink-pipe.yaml file to your local drive, and then edit it as needed for your configuration.

  2. Run the sink by using the following command:

    kubectl apply -f google-sheets-sink-pipe.yaml

Procedure for using the Kamel CLI

Configure and run the sink by using the following command:

kamel bind channel:mychannel -p "sink.accessToken=The Access Token" -p "sink.clientId=The Client Id" -p "sink.clientSecret=The Client Secret" -p "sink.refreshToken=The Refresh Token" -p "sink.spreadsheetId=The Spreadsheet ID" google-sheets-sink

This command creates the Kamelet Pipe in the current namespace on the cluster.

Kafka sink

You can use the google-sheets-sink Kamelet as a Kafka sink by binding it to a Kafka topic.

google-sheets-sink-pipe.yaml
apiVersion: camel.apache.org/v1
kind: Pipe
metadata:
  name: google-sheets-sink-pipe
spec:
  source:
    ref:
      kind: KafkaTopic
      apiVersion: kafka.strimzi.io/v1beta1
      name: my-topic
  sink:
    ref:
      kind: Kamelet
      apiVersion: camel.apache.org/v1
      name: google-sheets-sink
    properties:
      accessToken: The Access Token
      clientId: The Client Id
      clientSecret: The Client Secret
      refreshToken: The Refresh Token
      spreadsheetId: The Spreadsheet ID

Prerequisites

  • You’ve installed Strimzi.

  • You’ve created a topic named my-topic in the current namespace.

  • You have Camel K installed on the cluster.

Procedure for using the cluster CLI

  1. Save the google-sheets-sink-pipe.yaml file to your local drive, and then edit it as needed for your configuration.

  2. Run the sink by using the following command:

    kubectl apply -f google-sheets-sink-pipe.yaml

Procedure for using the Kamel CLI

Configure and run the sink by using the following command:

kamel bind kafka.strimzi.io/v1beta1:KafkaTopic:my-topic -p "sink.accessToken=The Access Token" -p "sink.clientId=The Client Id" -p "sink.clientSecret=The Client Secret" -p "sink.refreshToken=The Refresh Token" -p "sink.spreadsheetId=The Spreadsheet ID" google-sheets-sink

This command creates the Kamelet Pipe in the current namespace on the cluster.