0

When attempting to print to the console using Logger.log when running a formula in google sheets nothing is logged. How can I fix this? I am trying to do this in this part of my code:

        **Logger.log(data[row][col]);** 

Code:

    /**
This is only a test
**/
function getLonnie(data) {
  Logger.log("hello");
  var myArray = [];
  var numTimesLonnie = 0;
  for(var row = 0; row<data.length; row++){
    for(var col = 0; col<data[0].length; col++){
      if((data[row][col]) === "Lonnie"|| (data[row][col]) === "Lonnie G"){
      numTimesLonnie++;
        myArray.push(data[row][col])
        **Logger.log(data[row][col]);** ---> I am trying to log while in a formula here

      }
    }

  }

  return numTimesLonnie;
}
Lontronix
  • 193
  • 2
  • 15
  • Possible duplicate of [Printing to the console in Google Apps Script?](https://stackoverflow.com/questions/12377640/printing-to-the-console-in-google-apps-script) – Rubén Jan 22 '18 at 02:49
  • See [my answer](https://stackoverflow.com/a/48332184/1595451) to the above linked question. – Rubén Jan 22 '18 at 02:50
  • @Rubén That does not appear to be my problem, in my case no exception is thrown when I attempted to log the information of data[row][col] but nothing happens. – Lontronix Jan 22 '18 at 03:20
  • 1
    To print to the console we should use `console` instead of Logger and we should look at the Stackdriver console instead of the browser console. – Rubén Jan 22 '18 at 03:27
  • Related: [How to debug a spreadsheet custom function in google script?](https://stackoverflow.com/q/17258460/1595451) and [Debugging a custom function in Google Apps Script](https://stackoverflow.com/q/20288351/1595451) – Rubén Jan 22 '18 at 03:35
  • Does this answer your question? [How to debug or view logs in Google App Script fired from sheet](https://stackoverflow.com/questions/74288092/how-to-debug-or-view-logs-in-google-app-script-fired-from-sheet) – Dan Dascalescu May 03 '23 at 10:02

0 Answers0