PDF Realtime down load and conversion

216 views Asked by At

Im Looking for a way to use Google Apps Script to Download PDF file and convert file into Google Sheets.

The reason for this is that website only gives data in PDF form and i cant use Import function to get data for real-time updates

1

There are 1 answers

3
Yuri Khristich On

It depends on the way you will download your pdf files.

Here is simple example how you can convert PDF file from your Google Drive into Googe Document:

function pdfToDoc() {  
  var fileBlob = DriveApp.getFilesByName('test.pdf').next().getBlob();
  var resource = {
    title: fileBlob.getName(),
    mimeType: fileBlob.getContentType()
  };
  var options = {
    ocr: true
  };
  var docFile = Drive.Files.insert(resource, fileBlob, options);  
  Logger.log(docFile.alternateLink);  
}

To make it work you need to enable Drive API:

enter image description here

Based on the answer: https://webapps.stackexchange.com/a/136948

And as far as I can see there is only DOC as output. Probably you can extract data from DOC and put it into Spreadsheet with script. But it depends on how exactly looks your data.