I am trying to pass a 2D array created in a Javascript file here:
Code.gs
function getPermits()
{
Logger.log('Starting permits');
var permits = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().getDataRange().getValues();
Logger.log('Got permits: ' + permits [0][0]);
return permits;
}
And I call that function with a handler in this html file:
<script type="text/javascript">
function onSuccess(numUnread) {
alert('You have ' + numUnread[0][0]
+ ' unread messages in your Gmail inbox.');
document.getElementById("id2").innerHTML = numUnread[0][0];
}
function onFail(numUnread){
alert('Script failed!');
}
google.script.run.withSuccessHandler(onSuccess).getPermits();
google.script.run.withFailureHandler(onFail).getPermits();
</script>
The Logger.log('Got permits: ' + permits[0][0]);
call works perfect no matter what. However, while I can pass a 1D array in this manner and it works fine, passing a 2D array is causing this to fail. Why does this happen? Am I using improper syntax for this?
Thanks in advance