Creating import scripts
To create an import script, first open a new workbook and click on the Connections button in the upper right corner. Then, select Import Script as the datasource. By default, Equals will load an example import script that will bring dummy data into your workbook. You can toggle between Javascript and Python on this screen. You can replace the demo data with your custom code. If you have an API key that you don’t want to expose in your workbook’s script, you can use secret groups to hide these sensitive fields.Writing import scripts
We currently have two different languages that can be used to build Import Scripts: Javascript (Node 16) and Python (3.9) - you can swap between these for each connected sheet from the upper corner of the editor.
Javascript
Usage
First, import the equals library via a require statementconst equals = require("equals");. Then add data and set headings with the below methods.
equals.addRows(data)
Add rows of data to the sheet. Data must be an array of arrays, or an array of objects. Can be called repeatedly to add more data. If you set headers (below) and call addRows with an array of objects, we will use the header values to pluck corresponding values from the objects.
equals.addRow(data)
Add a single row of data (a list or an object).
equals.addHeaders(headers)
Add headings to the data being imported into the sheet. Should be an array of string objects. If not called, then either the keys of the first object, or the values of the first array will be used as headings.
equals.getSecret(secretKeyName)
Retrieve a secret passed to your script from your defined secret groups.
Python
Usage
First, import the equals library withimport equals. And then use the following methods to add data to your sheet.
equals.add_rows(data)
Add rows of data to the sheet. Data must be a list of lists, or a list of dicts; such as from JSON. Can be called repeatedly to add more data. If you set headers (below) and call addRows with a list of dicts, we will use the header values to pluck corresponding values from the dicts.
equals.add_row(data)
Convenience method for a single row of data (a list or a dict).
equals.add_headers(headers)
Add headings to the data being imported into the sheet. Should be a list of string objects. If not called, then either the keys of the first dict, or the values of the first list will be used as headings.
equals.get_secret(secret_key_name)
Retrieve a secret passed to your script from your defined secret groups.
Example - retrieving lead data from Intercom with Javascript
We’d like to get a list of all our leads in Intercom. We can do this with some custom Javascript. After adding a secret group with the API key we need, we can use the secret in the script:Example - fetching stock price with Python
We’d like to be able to pull in stock price information for AAPL on a monthly basis. To do this we can fetch the information from a remote API, and then get it automatically inserted into the spreadsheet.Dependencies
We provide some common dependencies for usage in Import Scripts. Javascript Version Node 16. Javascript Dependencies The following dependencies are available for usage in Javascript:| Package | Version |
|---|---|
| axios | 0.27.2 |
| lodash | 4.17.21 |
| luxon | 3.0.1 |
| mongodb | 4.8.1 |
| Package | Version |
|---|---|
| python-dateutil | 2.8.2 |
| mixpanel | 4.10.0 |
| requests | 2.26.0 |
| flatdict | 4.0.1 |
| pymongo | 4.2.0 |
| stripe | 4.0.2 |
Query views from a workbook Secret groups

