I would like to be able to read the values in a column from Google Sheet with JavaScript of HTML and add the values to a ComboBox or use them for other purpose. Basically I want to imitate the following action in VBA with Excel. (In excel if I want to read the Values in Column A I would do something like) Dim i as integer Dim value as string i = 1 //Read value on cell A1 Value = Range(“A” & i).value //Keep reading values on column A till cell is empty While value <> ” ” Value = Range(“A” & i).value //Add the value to ComboBox With ComboBox1 .AddItem value End With //Increase value of row to look at i = i + 1 Do Thank you so much
Here is the code that I tried. Could anyone help me to find out what I'm doing wrong? Thanks <html> <head> <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript"> google.load("visualization", "1", {packages:["corechart"]}); // To load this function when the window loads window.onload = function loadStates() { //I select only one value (In this case Alabama, to test if it works) var queryStringStates = encodeURIComponent('SELECT A LIMIT 1'); var magicIncantation = '/gviz/tq?gid=0&headers=1&tq='; //Put the query together var queryStates = new google.visualization.Query( 'https://docs.google.com/spreadsheets/d/1xfb9trifQA5KDPc9Nh5hBL4MJ290Mxcc1Uod2VTPzYI/edit' + magicIncantation + queryStringStates); //Get the data var dataStates = response.getDataTable(); //Load the data (In this case the state of Alabama) to the Selector which is in the body part with the //State of Texas by default to make sure that the Selector loads var x = document.getElementById("mySelect"); var option = document.createElement("option"); option.text = dataStates; x.add(option); } </script> </head> <body> <select id="mySelect"> <option value="Texas">Texas</option> </select> </body> </html>
As of now Google doesn't seems to provide JS only API for Google sheets. You need to build a JAVA or ASP.NET server to read the Google Sheets and then have your JS code call REST APIs from that server to fetch data. Check https://developers.google.com/google-apps/spreadsheets/?hl=en
I don't have a product yet. And I really need to test some stuff via the ClickBank API without having a product. Is it possible? And how?