2
votes

Whenever I try to "insert" lines into a fusion table using the non sql method I get the following error: "We're sorry, a server error occurred. Please wait a bit and try again." I am authenticated and can insert using the sql insert statement, but this has low limits for length of insert so I am trying to use a different method.

function temp () {
  var tableId = "<table id>";
  var blob = Utilities.newBlob(['hi', 'how', 'are you'].join(','), 
      {type: "octet/stream"});
  ret = FusionTables.Table.importRows(tableId, blob);
  Logger.log([ret,"for id"])
}
1

1 Answers

2
votes

For others landing on this question when creating the blob the documentation for Utilities.newBlob() requires a Byte[] and String. The working function would be:

function temp () {
  var tableId = "<table id>";
  var blob = Utilities.newBlob(['hi', 'how', 'are you'].join(','), 
      'application/octet-stream');
  ret = FusionTables.Table.importRows(tableId, blob);
  Logger.log([ret,"for id"])
}

For a tutorial on using FusionTables with Google Apps Script that contains a number of useful helper scripts see Integrating Google Analytics & Fusion Tables [Tutorial]