GoogleJsonResponseException: API call to drive.files.insert failed with Internal Error

Viewed 1026

I have the following code where I take the data from an ods file and convert and create that file to google sheets format in another folder

var ssOrige = DriveApp.getFileById(fileId)
var ssOrigeBlob = ssOrige.getBlob()
var ssName = ssOrige.getName()

var newFile = {
    title : ssName,
    parents: [{id: folderDestinationId}]
  }


var ssDestination = Drive.Files.insert(newFile, ssOrigeBlob, {convert: true})

I get the following error

GoogleJsonResponseException: API call to Drive.files.insert failed with Internal Error

The Drive API is active in this script

This usually happens when the file has many lines.

Sometimes the conversion is done correctly, but after many errors like this

I am accepting suggestions to convert an ods file to a spreadsheet in google format

1 Answers

Drive.Files.insert() relies to making use of the Drive API (V2) in Advanced Google Services Therefore, enable Drive API as an advanced Google Service. Goto the menu item: Resources > Advanced Google Services > Drive API. V3 throws the same error for me, but with V2 it runs.

Related