I am creating a Google Script to poll data from a spreadsheet (full code in the question here) and am getting this error when the google script is called: Uncaught Error: The script completed but the returned value is not a supported return type.
The google script is trying to return a 2D array - how can I fix the function so that it successfully passes the 2D array back to the next Javascript function?
function handleFormSubmit() {
var formObject = document.getElementById('text').value;
google.script.run.withSuccessHandler(createTable).getSportData(formObject);
}
/**
* Adds an html table
*/
function createTable(tableData) {
console.log("The tableData for createTable() is " + tableData);
var table = document.createElement('table');
var tableBody = document.createElement('tbody');
tableData.forEach(function(rowData) {
var row = document.createElement('tr');
rowData.forEach(function(cellData) {
var cell = document.createElement('td');
cell.appendChild(document.createTextNode(cellData));
row.appendChild(cell);
});
tableBody.appendChild(row);
});
table.appendChild(tableBody);
document.body.appendChild(table);
}