Digital Farmer
Digital Farmer

Reputation: 2107

ReferenceError: logger is not defined (Google Sheets / App Script)

Why this error?

ReferenceError: logger is not defined (line 4)

function myFunction() {
  var res = UrlFetchApp.fetch("https://api.cartolafc.globo.com/mercado/destaques");
  var content = res.getContentText();
  logger.log(res);
  logger.log(content);
}

Upvotes: 1

Views: 981

Answers (1)

Marios
Marios

Reputation: 27350

Try Logger.log instead.

Logger is the name of the class and log is a method of this class. There is not a built-in class in google scripts called logger.

You can also use console.log if you have V8 enabled.

See details here .

Upvotes: 2

Related Questions