I would like to import data from Google spreadsheets to my website.
Lets say, I have a page where there is a div-element with id ID "display", and inside the element there is a text "replace". So it would look like this:
<div id="display">replace</div>
function loadData() {
var url="https://docs.google.com/spreadsheet/pub?key=p_aHW5nOrj0VO2ZHTRRtqTQ&single=true&gid=0&range=A1&output=csv";
xmlhttp=new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if(xmlhttp.readyState == 4 && xmlhttp.status==200){
document.getElementById("display").innerHTML = xmlhttp.responseText;
}
};
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}
Now, I also have a Google spreadsheet document, which has a text "text-replaced", on the cell 1A.
So the question is, how do I import this cell to my website and replace the text "replace".
Any help?
I know this has been asked before, and I already tried this solution: (How do you Import data from a Google Sheets?), but id didn't work.