Script is "locked" when running Utilities.formatString ('% s', "text")

-1

( Translation of my question in SO in English , unanswered until the day of publication of this question)

Dear, hello. I'm writing a function to use in a Google spreadsheet, but it gets stuck when trying to run Utilities.formatString() . This is the script that I'm doing tests with:

/*
El argumento 'row' es un array:
["700002", 1234567890, "GROUP", "JOHN Q TAXPAYER", (new Date(1483336800000)), (new Date(-2209075151000)), 3333444455, "SALE", 20, "OK - (111111)", ""]
*/
function formatLog(row) {
  var e1 = row[7];
  var e2 = row[6];
  var e3 = row[8];
  var e4 = row[9];
  var ans = Utilities.formatString("Event %s %s %4.2f %s", e1, e2, e3, e4);  // El código se "traba" aquí
  return ans;
}

function testFormatLog() {
  var input_row = ["700002", 1234567890, "GROUP", "JOHN Q TAXPAYER", (new Date(1483336800000)), (new Date(-2209075151000)), 3333444455, "SALE", 20, "OK - (111111)", ""];
  var text_log = formatLog(input_row);
  Logger.log(text_log);
}

When debugging the testFormatLog() function, the execution transcript shows the following:

[17-01-13 10:41:45:399 CST] Iniciando ejecución
[17-01-13 10:42:04:308 CST] Error de ejecución: 
                            Lo sentimos, se produjo un error en el servidor. 
                            Aguarde un momento e inténtelo de nuevo. 
                            [18.898 segundos de tiempo de ejecución total]

I've even tried to execute Utilites.formatString('%s', "abc") , and even this line gets stuck!

Am I writing something wrong? Has anyone had the same problem and knows how to fix it?

    
asked by Barranka 16.01.2017 в 22:09
source

1 answer

0

In relation to what you tried with Utilites.formatString('%s', "abc") , I just tried with the following:

function myFunction() {
  var data = Utilities.formatString('%s', 'abc');
  Logger.log(data)
}

It worked without problems. For this reason I assume that it is an error outside your code, so as the message says,

  

... wait a moment and try again

If the problem persists, try the code I indicated in this answer.

    
answered by 17.01.2017 в 01:10