Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>After a deep research, finally i figured it out after a deep search and reading <a href="https://stackoverflow.com/questions/7082611/google-apps-script-update-fusion-table-from-spreadsheet-script">here</a>. This is how it looks for the code google docs spreadsheet app script:</p> <pre><code>function onOpen() { var tableID = '00000' // Add the table ID of the fusion table here var email = UserProperties.getProperty('email'); var password = UserProperties.getProperty('password'); if (email === null || password === null) { email = Browser.inputBox('Enter email'); password = Browser.inputBox('Enter password'); UserProperties.setProperty('email',email); UserProperties.setProperty('password', password); } else { email = UserProperties.getProperty('email'); password = UserProperties.getProperty('password'); } var authToken = getGAauthenticationToken(email,password); query = encodeURIComponent("SELECT * FROM tableID"); var URL = "http://www.google.com/fusiontables/api/query?sql=" + query; var response = UrlFetchApp.fetch(URL, { method: "get", headers: { "Authorization": "GoogleLogin auth=" + authToken, } }); var tableData = response.getContentText(); var o = Utilities.parseCsv(response.getContentText()); var doc = SpreadsheetApp.getActiveSpreadsheet(); var cell = doc.getRange('a1'); var index = 0; for (var i in o) { var row = o[i]; var col = 0; for (var j in row) { cell.offset(index, col).setValue(row[j]); col++; } index++; } } function getGAauthenticationToken(email, password) { password = encodeURIComponent(password); var response = UrlFetchApp.fetch("https://www.google.com/accounts/ClientLogin", { method: "post", payload: "accountType=GOOGLE&amp;Email=" + email + "&amp;Passwd=" + password + "&amp;service=fusiontables&amp;Source=testing" }); var responseStr = response.getContentText(); responseStr = responseStr.slice(responseStr.search("Auth=") + 5, responseStr.length); responseStr = responseStr.replace(/\n/g, ""); return responseStr; } </code></pre> <p>After that you can do whatever you want in the spreadsheet. BTW, I still think there is a simple way to import a private table into a spreadsheet automaticly.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload