title: Count total number of pages in pdf file
body: <p>Every week, I'll be receiving a set of pdf files from my clients.</p>
  
  <p>They will paste the pdf files in the specific google drive folder. I need a total number of pages of the pdf file. I was trying to create a code in Apps script which will helps to update the pdf file name and the total number of pages in the particular Google sheet.</p>
  
  <p>I found the code which was created for the google docs  <a href="https://ctrlq.org/code/20127-count-pdf-pages" rel="nofollow noreferrer">here</a> and <a href="https://stackoverflow.com/questions/11774217/how-do-i-find-the-page-number-number-of-pages-in-a-document">here</a>.</p>
  
  <p>But that doesn't work. I am looking for a Apps script which helps to check the particular drive folder and update the pdf file name and the total number of pages in the specific google sheet.</p>
  
  <p>I have tried to below script.</p>
  
  <pre><code>function getNumberofPages() {
    var myFolder = DriveApp.getFoldersByName("Test").next();
    var files = myFolder.searchFiles('title contains ".PDF"');
    while (files.hasNext()) {
      var file = files.next();
      Logger.log(file.getName());
      Logger.log(file.length);
    }
  }
  </code></pre>
  
  <p>But the length option is not working of pdf file....</p>
  
  <p>Thanks in advance.</p>