I've been working with Google Apps Script and I wanted a way to show data which is coming from a Google Sheet, so I found that this might help, but in that example the data is static. Do you have any ideas? Please.
That example will still work with data fetched via Ajax or supplied using Javascript. I'm not sure of the exact process but you will need to get JSON data from the Google Sheet in a format supported by Datatables. The Data docs describe what is supported. Basically you will need an array of rows with each row being an array or better an object. See this SO thread that seems to describe how to fetch JSON data from the Google Sheet.
You might be able to use ajax to fetch the data and use ajax.dataSrc with an empty string to point to the JSON data. See the Ajax docs for more details. Or use $.getJSON() and in the success function init Datatables and supply the data using data. See the Ajax sourced and Javascript sourced examples.
Answers
That example will still work with data fetched via Ajax or supplied using Javascript. I'm not sure of the exact process but you will need to get JSON data from the Google Sheet in a format supported by Datatables. The Data docs describe what is supported. Basically you will need an array of rows with each row being an array or better an object. See this SO thread that seems to describe how to fetch JSON data from the Google Sheet.
You might be able to use
ajax
to fetch the data and useajax.dataSrc
with an empty string to point to the JSON data. See the Ajax docs for more details. Or use$.getJSON()
and in the success function init Datatables and supply the data usingdata
. See the Ajax sourced and Javascript sourced examples.Let us know of any questions.
Kevin