title: How export sheets to pdf and upload it in one specific folder?
body: <p>I'm trying to convert one google sheet into a pdf file. Actually, that, seems ok. But i can't put it directly in one specifics folder ...</p>
  <p>Can you help me ?</p>
  <pre><code>const getData = await getSpreadSheetData(newSpreadsheetsId);
  if (!getData) {
      // nop
      return;
  }
  
  let url = getData.data.spreadsheetUrl;
  if (!url) {
      // nop
      return
  }
  url = url.replace(/edit$/, '');
  const url_ext = 'export?exportFormat=pdf&amp;format=pdf&amp;portrait=true'
  url = url + url_ext;
  const dest = fs.createWriteStream('test.pdf');
  await g.drive.files.export(
    {
      fileId: `${newSpreadsheetsId}`,  // Please set the file ID of Google Docs.
      mimeType: &quot;application/pdf&quot;
    },
    { responseType: &quot;stream&quot; },function(err, response) {
      if (err) {
        console.log(err);
        return;
      }
      if (!response) {
          // nop
          return
      }
      response.data
        .on(&quot;end&quot;, function() {
          console.log(&quot;Done.&quot;);
        })
        .on(&quot;error&quot;, function(err) {
          console.log(&quot;Error during download&quot;, err);
          return process.exit();
        })
        .pipe(dest);
    })
  </code></pre>
  <p>getSpreadSheetData retrieve me all the data from one spreadsheetID
  I'm not an expert with pipe etc ...
  I have trying some options like this link :
  <a href="https://github.com/googleapis/google-api-nodejs-client/issues/1622" rel="nofollow noreferrer">Github - google Drive export pdf in Landscape</a>
  And i don't want this file on my server, or transiting by my server ... :/</p>