Skip to main content

Overview

Use ctx.sheet() to push data (like employees, jobs, contacts) from one sheet to another.

Methods

ctx.sheet()

Get a reference to any sheet by name.
const employeesSheet = ctx.sheet("Employees");

addRow()

Add a single row to a sheet.
await sheet.addRow(data);

addRows()

Add multiple rows at once.
await sheet.addRows(arrayOfData);

getRows()

Query rows from this sheet with filtering and sorting.
const rows = await sheet.getRows(query, limit);

Query Reference

See the full getRows() documentation for filtering operators, sorting options, and examples.

Example: Push Employees to Another Sheet

// Get employees for a company
const employees = await services.company.getEmployees({
  linkedinCompanyUrl: ctx.thisRow.get("LinkedIn URL"),
  options: { limit: 50 },
});

// Push each employee to the Employees sheet
const employeesSheet = ctx.sheet("Employees");

await employeesSheet.addRows(
  employees.map((emp) => ({
    company_id: ctx.rowId,
    name: emp.full_name,
    title: emp.job_title,
    linkedin: emp.websites_linkedin,
  }))
);

return employees.length;

Example: Push Jobs to Another Sheet

// Scrape job listings
const jobs = await services.company.careers.scrapeJobs({
  url: ctx.thisRow.get("Careers URL"),
});

// Push to Jobs sheet
await ctx.sheet("Jobs").addRows(
  jobs.map((job) => ({
    company_id: ctx.rowId,
    title: job.title,
    location: job.location,
  }))
);

return jobs.length;