google-apps-scriptgoogle-sheetsgoogle-fusion-tables

Update a Google fusion table from a Google Spreadsheet


I have to be able to update a Google fusion table from a Google Spreadsheet.

This (https://gist.github.com/chrislkeller/3013360) is obsolete.

There is a new Google Fusion Tables API, but when I've looked at the official examples for connecting with Google OAuth 2.0, like so (https://developers.google.com/fusiontables/docs/samples/python), it involves working around oauth.

There has to be an easier way of doing this, like at least some sort of Google OAuth built into Google Apps Scripts.... Better yet, some existing library. What am I missing?


Solution

  • Thanks for all the responses. I had already enabled Advanced Service for Fusion tables. Turns out I don't need any auth library.

    This tutorial is perfect: https://cdn.rawgit.com/fusiontables/fusion-tables-api-samples/master/FusionTablesSheetSync/docs/reference.html

    Summary: Once you've enabled advanced service you can do something like:

    FusionTables.Table.replaceRows(TABLE_ID, csvBlob, {...})
    

    (where the TABLE_ID is your Fusion Table ID, found in "File -> About this table")

    I also set up a trigger to run every time someone made a change, by going into my App script, in the menu navigating to "Resources > Current project's triggers", and setting my function to be called when something is edited in the spreadsheet through the "onEdit" callback.

    Google handles auth for me, as I suspected.