Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

134
Views
typeerror cannot read property 'length' of undefined app script

Hi I am trying to use this code to import a JSON file from API I keep getting this error "TypeError: Cannot read property 'length' of undefined"

PIVOT_URL_Country = ""
SHEET_NAME_Country = "test"

function updateDataCountry() {
const response = JSON.parse(UrlFetchApp.fetch(PIVOT_URL_Country))
const headers = [response.headers]
const data = response.report
const output = headers.concat(data)
const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(SHEET_NAME_Country)
sheet.getDataRange().clearContent()
sheet.getRange(1, 1, output.length, output[0].length).setValues(output)
}

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!