Phantombuster’s googlesheet templates: How to handle heavy files?

Fabian Maume
4 min readDec 16, 2021

--

Phantombuster’s is offering several cool templates to orchestrate your automation. The template for Linkedin outreach is one of my favorite. I also created and shares a few templates of my own, like this template to handle Czech declination while running LinkedIn outreach.

However, if you have already used some of those templates you might have faced an annoying issue: heavy result files.

All those google-sheets templates are using the google function “importData” to push the data from Phantombuster to google-sheet. Unfortunately, this function cannot import result files larger than 100k cells.

When this issue occurs you can manually import the csv file using this workaround:

However, it means that your template won’t update automatically, so you cannot leave your automation run in auto-pilot.

I developed an automation, which leverages google-sheet API to solve this issue. In this article, I will walk you through the setup.

Step 1: Get a Google API credentials

This is the most challenging step, so fasten your seatbelt for the ride.

Go to google developer console and create a project.

Then click on “Enable APIs and services”

Search for “google sheet” and click on the “Enable” button.

Go back to google developer console. On the left side click on Credentials:

Click on “Create credential” and pick the “Service account” option:

Enter name and description, click “CREATE”.

You can skip permissions and click “CONTINUE”.

Click “+ CREATE KEY” button.

Select the “JSON” key type option.

Click the “Create” button.

A JSON key file will be generated and downloaded to your machine (Do not share this file!).

Click on “DONE”.

Keep the JSON at hand, and do not share this file with anybody else.

Step 2: Prepare the spreadsheet

You will have to make some preparation work on your google sheet.

First of all, it is good to make a manual import of the current version of your result file. You can follow this tutorial for it.

You will also need to grant edit rights to the service account you just created. Open the Json file that you download on the previous stage. Look for “GOOGLE_SERVICE_ACCOUNT_EMAIL” and copy the email. On the google-sheet click on the share button and grant edit right to this email address. This will allow the google API to edit the file on your behalf.

Step 3: Setup phantom to push the data

Now you will need a phantom to push data in the google sheet for you. 👻

First of all, you will have to enable the developer on your account. This will able you to easily edit the agent object later. You can check this video to know how to enable the developer mode:

Visit this url, and click on “Use this phantom”. This is a custom phantom I developed so it won’t be visible on the official phantombuster store.

You should have the phantom setup opening up by default:

Copy-paste the data from here in the field on your right. Edit the information as follow:

  • googleSheetID: This is part of your google-sheet URL. Copy the part of the URL between “/spreadsheets/d/” and “/edit#gid”.
  • GOOGLE_SERVICE_ACCOUNT_EMAIL: You have this information in the JSON file from step 1.
  • GOOGLE_PRIVATE_KEY: You have this information in the JSON file from step 1. It is quite a long string of text.
  • Input_url: the result URL of the Phantom you want to push to google sheet. You should already have this URL at hand from setting up your googlesheet template.
  • sheetTitle: the name of the sheet to which you want to push the data (name of the exact sheet not of the one of the spreadsheet).

Click next on the setup. Pick the option to launch your Phantom “every time another Phantom finishes”:

In the drop-down menu pick the Phantoms for which you want to push the result to googlesheet. Every time there will be new results for your phantom the information will be pushed to your google template.

Click on “save”.

Click on the triple point on the right side:

Click on “Agent Object”. Copy-paste the data from here. Set the number of LastProcessed, to the current number of rows in your google-sheet (this is for the automation to not duplicate the rows you have already imported). Remove the “// number of last line imported in the googlesheet template”, and click “save”.

You are all set. You can leave your automation run on autopilot again.

If you are facing any issue or would need some help building custom automation templates do not hesitate to get in touch: tetriz.io

--

--

No responses yet