1

Not sure if this is even possible. But ideally, I'd like visitors to my site to be able to type a unique identification number in an input field, click submit, and have another script replace the Google sheet reference ("DATA1") with their own ID number.

So, effectively change the queried url. Here's part the script/url users need to modify:

function loadChart() {
  var query = new google
    .visualization.Query('https://docs.google.com/spreadsheet/ccc?key=...&sheet=DATA1');
  query.send(handleQueryResponse);
}

Would it be possible to use/modify something like the following code to do the trick

function myFunction() {
  var str = document.getElementById("get").innerHTML; 
  var changeit = str.replace("DATA2", document.getElementById('textbox').value);
  document.getElementById("get").innerHTML = changeit;
}

Thanks for any help or direction you can provide

firenemus
  • 165
  • 3
  • 13
  • possible duplicate of [Modify the URL without reloading the page](http://stackoverflow.com/questions/824349/modify-the-url-without-reloading-the-page) – Robert Moskal Jun 06 '15 at 20:59

1 Answers1

1

Instead of including DATA1 in the URL, append it with data coming from f.ex a textbox:

function loadChart() {
  var txtbox = document.getElementById('textbox').value;
  var url = 'https://docs.google.com/spreadsheet/ccc?key=...&sheet=' + txtbox;
  var query = new google.visualization.Query(url);

  query.send(handleQueryResponse);
}
Robert McKee
  • 21,305
  • 1
  • 43
  • 57
  • THANK YOU ROBERT MCKEE! I've been trying to figure this out for the past two days. So simple I want to slap myself! – firenemus Jun 06 '15 at 21:27