🎉 Congratulations, you got a 50% off coupon (5ALQJO96)

Google Sheets

In this section, we will learn how to use the Google Sheets block.

Use Cases

The Google Sheets block allows you to easily read and write data to and from Google Sheets. For example, you can scrape product lists from Amazon and write the data into a specified spreadsheet.

example

How Does It Work?

There are two ways to enable Tapicker to read or write to Google Sheets. You need to set the sheet's permissions to one of the following:

  • Accessible or editable by anyone.

    share-with-anyone

  • Shared with the account service@tapicker.iam.gserviceaccount.com.

    share-with-tapicker

Spreadsheet ID

You can find the Spreadsheet ID in the URL of your sheet. For example:

sheet-test

Range

Refer to A1 notation for specifying ranges.

Read a Sheet

Assume the content of the spreadsheet is as follows:

sheet-example

If you want to read the entire sheet, set Range to Sheet1. You will get the following data:

[
  ["Name", "Age"],
  ["Anna", "18"],
  ["Ben", "19"]
]

If you want to read only a part of the data, set Range to Sheet1!A1:B2. You will get:

[
  ["Name", "Age"],
  ["Anna", "18"]
]

With header conversion enabled (enabled by default), you will get:

[
  { "Name": "Anna", "Age": "18" },
  { "Name": "Ben", "Age": "19" }
]

Write a Sheet

You can write data into Values. Two formats are supported for writing data:

1. 2D Array

[
  ["Name", "Age"],
  ["Anna", "18"],
  ["Ben", "19"]
]

2. Array of Objects

[
  { "Name": "Anna", "Age": "18" },
  { "Name": "Ben", "Age": "19" }
]

The array of objects will be converted into a 2D array:

[
  ["Anna", "18"],
  ["Ben", "19"]
]

When you enable the Include Header option, it will add the object keys as headers in the first row:

[
  ["Name", "Age"],
  ["Anna", "18"],
  ["Ben", "19"]
]

3. Write Extracted Data

The extracted data is stored in memory as an array of objects. You can write it directly to Google Sheets using Template Syntax:

{{@tables.T208.$rows}}