Handling thisRow Object in Coda Pack Formula for HTTP POST Request

Hello, Coda Pack Developers!

I’m currently developing a custom Coda Pack and facing a challenge with processing and utilizing the thisRow object. My goal is to pass the entire row (thisRow) as a parameter to my pack’s formula, which later makes an HTTP POST request to my API with the row data. For debugging purposes, I’m trying to print the output to the first cell of the row to confirm that I have the full row data before sending it off.

However, I’ve encountered a snag: when I attempt to log or return the thisRow parameter to the first cell, it only outputs the content of the first cell of the row, not the full row object as I expected. My intention is to capture the complete row data in a format that I can then serialize and send in my POST request. Here’s a snippet of the problematic code:

import * as coda from "@codahq/packs-sdk";

export const pack = coda.newPack();

// https://help.coda.io/en/articles/3598277-what-is-thisrow-and-when-do-i-use-it

pack.addNetworkDomain('timeapi.io');

pack.addFormula({
  name: "fetchAPI",
  description: "Fetch data from API and alert it.",

  parameters: [
    coda.makeParameter({
      type: coda.ParameterType.StringArray,
      name: 'thisRow',
      description: 'The current row',
    }),
  ],

  resultType: coda.ValueType.String,

  execute: async ([thisRow], context) => {
    try {
      let fetcher = context.fetcher;

      let response = await fetcher.fetch({
        method: "GET",
        url: "https://timeapi.io/api/Time/current/zone?timeZone=UTC",
      });

      let parsed = response.body;
      console.log("Retrieved: ", parsed);
      return `Data fetched successfully: ${parsed["dateTime"]}. Current row data: ${thisRow}`;
    } catch (error) {
      console.error('Error fetching data:', error);
      return "Error fetching data. Please check the console for details.";
    }
  },
});

I invoke this in Coda using ModifyRows function like so:

ModifyRows(
  thisRow, [Test Table].[Action UTC Time], MyPack::fetchAPI(thisRow)
)

My questions are:

  1. How can I properly capture and utilize the entire thisRow object within my pack formula so that I can later POST it to my API?
  2. What data type should the thisRow parameter be declared as to achieve this?

I’ve read through the documentation and various community posts but haven’t found a clear guide on handling entire row objects for use in HTTP requests within Packs. Any guidance, examples, or references to documentation would be incredibly appreciated!


I expected to see Current row data: text1, text2, - but there is only text1

Thank you in advance for your help and insights!