0

I was using this code for some time in Google Script and it stopped working several weeks ago. Trying to get the code back up but can't seem to figure it out.

The error message I get is :

Exception: Unexpected error while getting the method or property insert on object Apiary.drive.files. (line 125, file "Code")

Line 125 is the line:

var gdocFile = Drive.Files.insert(resource, pdfFile, insertOpts).id;

  // Save PDF as GDOC
  resource.title = pdfName.replace(/.pdf$/, '');
  var insertOpts = {
    ocr: true,
    ocrLanguage: options.ocrLanguage || 'en',
    uploadType: 'multipart'
  };
  
  var gdocFile = Drive.Files.insert(resource, pdfFile, insertOpts).id;  
  
  //Get text from GDOC  
  var gdocDoc = DocumentApp.openById(gdocFile);
  var text = gdocDoc.getBody().getText();
WAIL
  • 1

1 Answers1

0

Problem resolved by using the information from the following post: Google App Script : how to convert PDF to GDOC in order to get OCR?

Seems that Drive.Files.insert is no longer supported.

WAIL
  • 1