How to create orders in Track-POD from Google Sheets using Zapier

Created by Volha Viachorka, Modified on Fri, 5 Jul at 2:44 PM by Volha Viachorka

Have you been wondering how to automatically send orders with multiple goods from Google Sheets to Track-POD? Here’s a guide on how this can be achieved by running a JavaScript code in Zapier.


In Zapier, register or log in to your existing account. You will be taken to your Zapier dashboard. The dashboard will prompt you to "create a new Zap". So we will create a new zap and choose Google Sheets app.



Now let’s proceed with creating a zap:


  1. The first step is to choose an event that will trigger the creation of orders. Select “New Worksheet” in the Event dropdown list:



You will then proceed with logging into your Google Sheets account, choosing the correct Google Drive and spreadsheet and continue with the “Test” step. In the test results you will receive a Sheet ID.



2.  With the second step we need to get the data from the file. Add a new action for Google Sheets and select “Get Many Spreadsheet Rows” in the Events drop-down list:



In the Action section after selecting the Drive and Spreadsheet, the following required fields need to be filled in:


Worksheet. Switch to Custom and select the Sheet ID you have received in the previous step.


Row Count.  500 (Please note that this is the maximum number of rows in the file). 


First Row.  1 (It’s necessary to include the header row for correct column mapping).


Then proceed with Test.



3. Add next action Code by Zapier and select Run JavaScript as an Event:




In the Action section enter “Data” in Input Data field and select Get Many Spreadsheet Rows -> Raw Rows.



Then proceed with inputting the script below into the Code window. 

In the keyColumnsNames all the unique columns which will be used to group the orders by, need to be specified. 

In the goodsColumnsNames all the Goods-related columns from the file need to be listed.


// specify unique order columns names
// if keyColumnsNames from different rows have different values, multiple orders will be created
const keyColumnsNames = ['Number'];
// specify columns names related to line items / goods
const goodsColumnsNames = [
  'Goods',
  'Quantity',
  'Price'
];
const rows = JSON.parse(inputData.Data);
const columnNames = rows[0];
const orders = [];
for (let i = 1; i < rows.length; i++) {
  const row = rows[i];
  let order = orders.find(x => {
    for (let j = 0; j < keyColumnsNames.length; j++) {
      const columnName = keyColumnsNames[j];
      var columnIndex = columnNames.indexOf(columnName);
      if (x[columnName] !== row[columnIndex]) {
        return false;
      }
    }
    return true;
  });
  if (!order) {
    order = {};
    order.line_items = []
    orders.push(order);
  }
  const goods = {}
  for (let j = 0; j < columnNames.length; j++) {
    const columnName = columnNames[j];
    if (goodsColumnsNames.find(x => x === columnName)) {
      goods[columnName] = row[j];
    } else {
      order[columnName] = row[j];
    }
  }
  order.line_items.push(goods);
}
output = orders;


4. Create order in Track-POD


Add the next action to create a new order in Track-POD. 


Connect your Track-POD account. 


In the Action section proceed with mapping the columns by selecting them from the Run Javascript in Code by Zapier list:



For the required Goods Name field select “Line Items Goods” and “Line Items Quantity” for required Quantity field correspondingly:


That’s it. You can now proceed with testing the full scenario of creating orders with multiple goods lines from a new worksheet in Google Sheets to Track-POD.

You can also use this template to help you create the integration.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article