Back | Blog
Gabriel Becker

Gabriel BeckerWebhooks

How to push Boto data to Google Sheets (without Zapier)

Cover Image for How to push Boto data to Google Sheets (without Zapier)

Wondering how to connect Boto to Google Sheets?

Learn here the basic steps to create a bot that will push data into a Google Sheet. Recently we shared how to Connect Web3 to Zapier with webhooks but that requires a premium subscription to Zapier. These instructions still require a Boto Pro subscription, but for a little extra work, you skip the need for a Zapier subscription.

In this example, we’ll collect NFT sales data and log each sale in a sheet. The steps are split in two parts: Part 1, where we’ll set up the google sheet and prepare it to receive data from the bot, and Part 2, where we’ll set up the bot to send data to the sheet.

A huge thanks to Foxtrot#9999 (@FoxtrotETH), the Boto Expert who showed us how to pull this off!

Part 1

Create a new Google Sheet and rename the sheet or tab to Sales. Optionally, name the column headers as in the example below. It helps to read the sales data later.

[object Object]

Go to the Extensions menu and choose Apps Script. Copy the code below and paste it in there.

function doPost(e) {
    var args = e.parameter.args.split(";");
    var name = args[0]
    var id = args[1]
    var price = args[2]
    var price_token = args[3]

    var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sales");

    // insert new row with nft sales data
    var newRow = [name, id, price, price_token];
    sheet.appendRow(newRow);
    return ContentService.createTextOutput("New sales added to sheet");
}

It should look like this:

[object Object]

This function adds the name, id, price and price token of a sold NFT into the table. We’ll make this function run whenever the bot (that we’ll create in Step 2) tracks a new sale.

Click Deploy > New Deployment, then in the pop-up, click the cog to Enable deployment types and select Web app.

[object Object]

On “Who has access”, choose Anyone. This will allow Boto to call this Web app through a webhook to add data to the Google sheet. Add any Description (I entered one just for clarity). Finally, click Deploy and then, Allow Access to your sheets.

[object Object]

Click Copy to copy the Web app URL. Keep this stored somewhere, we’ll use in the bot.

[object Object]

Part 2

Use the recipe NFT Events to Discord Bot (https://boto.io/bots/324/) to create a bot.

Set the following address

0x33fd426905f149f8376e227d0c9d3340aad17af1

for The Memes by 6529 collection and select a Discord channel (or add a channel first, if you don’t find your channel).

[object Object]

It’s not mandatory to send sales alerts to Discord, but it’s useful to get an alert when new data was added to the table. If you don’t want the alert, just delete the Discord block.

Search for the Webhook block, drag and drop into your bot and connect it to the NFT Events block. This allows us to pull NFT sales data and push it into a Webhook.

[object Object]

Remember the Web app URL that you copied at the end of Part 1? Paste it into the URL field in the Webhook block. Then, copy this text {"args":""} and paste it into the Data field. Here’s what your bot should look like.

[object Object]
Now, we’ll add the output tags that we want to see logged in sheet. In the Data field, click between the quotes, hit # (the hash sign) and select #5.name and type ; (the semi-colon sign)Repeat these steps for the other output tags: #5.token_id #5.price and #5.price_token
[object Object]

Finally, click on Save Bot and hit the toggle button to turn the bot on. That’s it! Your bot will start logging data into your Google Sheet.

After a few sales logged, here’s how your table should look like:

[object Object]

Need any help? Join our Discord or email us: info@boto.io

Explore all of our no-code bot recipes, created and shared by people like you: https://boto.io/bots

Check out what we’re up to on Twitter: https://twitter.com/boto_io

boto-logo

Webhooks

Google-sheets

NFTS

Share
Gabriel BeckerAbout Gabriel

Gabriel Becker is the Head of Customer Success and Operations at Boto.io and has worked with IT systems integration, automated intralogistics and operations management. He studied Control and Automation Engineering and an did an MBA at INSEAD. Need any help with Boto? He'll be there for you!

Related Articles