Answers for "load data table app script"

0

load data table app script

<script type='text/javascript'>
    $(document).ready(function(){
        var runner = google.script.run.withFailureHandler(onFailure);
        runner.withSuccessHandler(onSuccess).getData();
    });
    var onSuccess = function(data){
        var aDataSet = data.slice(1);  // all except header


        var head = [];  // headers
        data[0].forEach(function(e){
            head.push({'sTitle': e});
        });

        $('#demo').html( '<table cellpadding="0" cellspacing="0" border="0" class="display" id="example"></table>' );
        $('#example').dataTable( {
            "aaData": aDataSet,
            "aoColumns": head
        });
    }
    var onFailure = function(err){
        alert(err.message);
    }
    </script>
Posted by: Guest on March-22-2021
0

load data table app script

function getData(){
   var data = SpreadsheetApp.openById('YourSheetID').getSheetByName('YourSheetName').getDataRange().getValues();
   return data;
}
Posted by: Guest on March-22-2021

Browse Popular Code Answers by Language