So I'm working with a Google Script. The script pulls information from a google spreadsheet and should be displaying it in the datatable. The table is creating correctly and using the columns I've defined, the data just isn't pulling in. When I debug my script the dataset is populated and should be returned from the function.
Are data tables able to be loaded from a function returning the dataset?
<script>
$(document).ready(function() {
$('#customerlist').DataTable( {
data: google.script.run.getData(),
columns: [
{ title: "Company" },
{ title: "Service Type" },
{ title: "Email" },
{ title: "Contact1" },
{ title: "Cell #" },
{ title: "Contact 2" },
{ title: "Cell #" },
{ title: "Contact 3" },
{ title: "Cell #" },
{ title: "Contact 4" },
{ title: "Cell #" },
{ title: "Contact 5" },
{ title: "Cell #" },
{ title: "Contact 6" },
{ title: "Cell #" },
{ title: "Contact 7" },
{ title: "Cell #" },
{ title: "Contact 8" },
{ title: "Cell #" },
{ title: "Contact 9" },
{ title: "Cell #" }
]
} );
} );
</script>
function getData(){
var id = "abc";
var sheetname = "Master";
var dataSet = SpreadsheetApp.openById(id).getSheetByName(sheetname).getDataRange().getValues();
return dataSet;
}