← Twitter + Google Sheets integrations

Add Single Row with Google Sheets APIon New Tweet in List from Twitter API

Pipedream makes it easy to connect APIs for Google Sheets, Twitter and + other apps remarkably fast.

Trigger workflow on
New Tweet in List from the Twitter API
Next, do this
Add Single Row with the Google Sheets API
No credit card required
Trusted by 200,000+ developers from startups to Fortune 500 companies:
Trusted by 200,000+ developers from startups to Fortune 500 companies

Developers Pipedream

Getting Started

This integration creates a workflow with a Twitter trigger and Google Sheets action. When you configure and deploy the workflow, it will run on Pipedream's servers 24x7 for free.

  1. Select this integration
  2. Configure the New Tweet in List trigger
    1. Connect your Twitter account
    2. Optional- Configure Count (advanced)
    3. Optional- Configure Max API Requests per Execution (advanced)
    4. Configure Polling interval
    5. Optional- Select a Retweets
    6. Select a List
    7. Configure Entities
  3. Configure the Add Single Row action
    1. Connect your Google Sheets account
    2. Select a Drive
    3. Select a Spreadsheet
    4. Select a Sheet Name
    5. Select a Does the first row of the sheet have headers?
  4. Deploy the workflow
  5. Send a test event to validate your setup
  6. Turn on the trigger

Details

This integration uses pre-built, open source components from Pipedream's GitHub repo. These components are developed by Pipedream and the community, and verified and maintained by Pipedream.

To contribute an update to an existing component or create a new component, create a PR on GitHub. If you're new to Pipedream component development, you can start with quickstarts for trigger span and action development, and then review the component API reference.

Trigger

Description:Emit new Tweets posted by members of a list
Version:0.0.2
Key:twitter-new-tweet-in-list

Trigger Code

import base from "../common/tweets.mjs";

export default {
  ...base,
  key: "twitter-new-tweet-in-list",
  name: "New Tweet in List",
  description: "Emit new Tweets posted by members of a list",
  version: "0.0.2",
  type: "source",
  props: {
    ...base.props,
    includeRetweets: {
      propDefinition: [
        base.props.twitter,
        "includeRetweets",
      ],
    },
    list: {
      propDefinition: [
        base.props.twitter,
        "list",
      ],
    },
    includeEntities: {
      type: "boolean",
      label: "Entities",
      description: `
        Include the 'entities' node, which offers a variety of metadata about the
        tweet in a discreet structure, including: user_mentions, urls, and hashtags
      `,
      default: false,
    },
  },
  methods: {
    ...base.methods,
    shouldIncludeRetweets() {
      return this.includeRetweets !== "exclude";
    },
    retrieveTweets() {
      return this.twitter.getListTweets({
        listId: this.list,
        count: this.count,
        sinceId: this.getSinceId(),
        includeEntities: this.includeEntities,
        includeRetweets: this.shouldIncludeRetweets(),
      });
    },
  },
};

Trigger Configuration

This component may be configured based on the props defined in the component code. Pipedream automatically prompts for input values in the UI and CLI.
LabelPropTypeDescription
N/Adb$.service.dbThis component uses $.service.db to maintain state between component invocations.
TwittertwitterappThis component uses the Twitter app.
Count (advanced)countinteger

The maximum number of tweets to return per API request (up to 100)

Max API Requests per Execution (advanced)maxRequestsinteger

The maximum number of API requests to make per execution (e.g., multiple requests are required to retrieve paginated results). Note: Twitter rate limits API requests per 15 minute interval.

Polling intervaltimer$.interface.timer

Pipedream will poll the YouTube API on this schedule

RetweetsincludeRetweetsstringSelect a value from the drop down menu:{ "label": "Include", "value": "include" }{ "label": "Exclude", "value": "exclude" }{ "label": "Only include retweets", "value": "filter" }
ListliststringSelect a value from the drop down menu.
EntitiesincludeEntitiesboolean
    Include the 'entities' node, which offers a variety of metadata about the
    tweet in a discreet structure, including: user_mentions, urls, and hashtags

Trigger Authentication

Twitter uses OAuth authentication. When you connect your Twitter account, Pipedream will open a popup window where you can sign into Twitter and grant Pipedream permission to connect to your account. Pipedream securely stores and automatically refreshes the OAuth tokens so you can easily authenticate any Twitter API.

Pipedream requests the following authorization scopes when you connect your account:

About Twitter

From breaking news and entertainment to sports and politics, get the full story with all the live commentary.

Action

Description:Add a single row of data to Google Sheets
Version:2.0.0
Key:google_sheets-add-single-row

Action Code

import googleSheets from "../../google_sheets.app.mjs";

export default {
  key: "google_sheets-add-single-row",
  name: "Add Single Row",
  description: "Add a single row of data to Google Sheets",
  version: "2.0.0",
  type: "action",
  props: {
    googleSheets,
    drive: {
      propDefinition: [
        googleSheets,
        "watchedDrive",
      ],
    },
    sheetId: {
      propDefinition: [
        googleSheets,
        "sheetID",
        (c) => ({
          driveId: googleSheets.methods.getDriveId(c.drive),
        }),
      ],
      description: "",
      withLabel: true,
    },
    sheetName: {
      propDefinition: [
        googleSheets,
        "sheetName",
        (c) => ({
          sheetId: c.sheetId.value,
        }),
      ],
      description: "",
    },
    hasHeaders: {
      type: "string",
      label: "Does the first row of the sheet have headers?",
      description: "If the first row of your document has headers we'll retrieve them to make it easy to enter the value for each column.",
      options: [
        "Yes",
        "No",
      ],
      reloadProps: true,
    },
  },
  async additionalProps() {
    const props = {};
    if (this.hasHeaders === "Yes") {
      const { values } = await this.googleSheets.getSpreadsheetValues(this.sheetId.value, `${this.sheetName}!1:1`);
      for (let i = 0; i < values[0]?.length; i++) {
        props[`col_${i.toString().padStart(4, "0")}`] = {
          type: "string",
          label: values[0][i],
          optional: true,
        };
      }
    } else if (this.hasHeaders === "No") {
      props.myColumnData = {
        type: "string[]",
        label: "Values",
        description: "Provide a value for each cell of the row. Google Sheets accepts strings, numbers and boolean values for each cell. To set a cell to an empty value, pass an empty string.",
      };
    }
    return props;
  },
  async run({ $ }) {
    let cells;
    if (this.hasHeaders === "Yes") {
      cells = Object.keys(this).filter((prop) => prop.startsWith("col_"))
        .sort()
        .map((prop) => this[prop]);
    } else {
      cells = this.googleSheets.sanitizedArray(this.myColumnData);
    }

    // validate input
    if (!cells || !cells.length) {
      throw new Error("Please enter an array of elements in `Cells / Column Values`.");
    } else if (!Array.isArray(cells)) {
      throw new Error("Cell / Column data is not an array. Please enter an array of elements in `Cells / Column Values`.");
    } else if (Array.isArray(cells[0])) {
      throw new Error("Cell / Column data is a multi-dimensional array. A one-dimensional is expected. If you're trying to send multiple rows to Google Sheets, search for the action to add multiple rows to Sheets.");
    }

    const data = await this.googleSheets.addRowsToSheet({
      spreadsheetId: this.sheetId.value,
      range: this.sheetName,
      rows: [
        cells,
      ],
    });

    $.export("$summary", `Added 1 row to [${this.sheetId.label} (${data.updatedRange})](https://docs.google.com/spreadsheets/d/${this.sheetId.value})`);

    return data;
  },
};

Action Configuration

This component may be configured based on the props defined in the component code. Pipedream automatically prompts for input values in the UI.

LabelPropTypeDescription
Google SheetsgoogleSheetsappThis component uses the Google Sheets app.
DrivedrivestringSelect a value from the drop down menu.
SpreadsheetsheetIdstringSelect a value from the drop down menu.
Sheet NamesheetNamestringSelect a value from the drop down menu.
Does the first row of the sheet have headers?hasHeadersstringSelect a value from the drop down menu:YesNo

Action Authentication

Google Sheets uses OAuth authentication. When you connect your Google Sheets account, Pipedream will open a popup window where you can sign into Google Sheets and grant Pipedream permission to connect to your account. Pipedream securely stores and automatically refreshes the OAuth tokens so you can easily authenticate any Google Sheets API.

Pipedream requests the following authorization scopes when you connect your account:

emailprofilehttps://www.googleapis.com/auth/drive

About Google Sheets

With Google Sheets, you can create, edit, and collaborate wherever you are

More Ways to Connect Google Sheets + Twitter

About Pipedream

Stop writing boilerplate code, struggling with authentication and managing infrastructure. Start connecting APIs with code-level control when you need it — and no code when you don't.

Into to Pipedream
Watch us build a workflow
Watch us build a workflow
4 min
Watch now ➜
"The past few weeks, I truly feel like the clichéd 10x engineer."
@heyellieday
Powerful features that scale
Manage concurrency and execution rate
Manage concurrency and execution rate

Queue up to 10,000 events per workfow and manage the concurrency and rate at which workflows are triggered.

Process large payloads up to 5 terabytes
Process large payloads up to 5 terabytes

Large file support enables you to trigger workflows with any data (e.g., large JSON files, images and videos) up to 5 terabytes.

Return custom responses to HTTP requests
Return custom responses to HTTP requests

Return any JSON-serializable response from an HTTP triggered workflow using $respond().

Use most npm packages
Use most npm packages

To use any npm package, just require() it -- there's no npm install or package.json required.

Maintain state between executions
Maintain state between executions

Use $checkpoint to save state in one workflow invocation and read it the next time your workflow runs.

Pass data between steps
Pass data between steps

Return data from any step to inspect it in a human-friendly way and reference the data in future steps via the steps object.