<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Excel files uploaded to Dropbox using Node.js SDK are invalid in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Excel-files-uploaded-to-Dropbox-using-Node-js-SDK-are-invalid/m-p/489738#M24520</link>
    <description>&lt;P&gt;I am trying to upload Excel files to Dropbox using the Node.js SDK (&lt;A href="https://github.com/dropbox/dropbox-sdk-js" target="_blank" rel="noopener"&gt;https://github.com/dropbox/dropbox-sdk-js&lt;/A&gt;). The files are received from JsReport, and are saved correctly when saved to my local disk. However, when uploading to Dropbox, the files end up long strings instead of Excel files.&lt;/P&gt;
&lt;P&gt;The body in this case is a string that gets encoded to base64. The filename is speedtest_daily_2021-01-15_test26.xlsx.&lt;/P&gt;
&lt;P&gt;This line writes the file successfully to my local drive:&lt;/P&gt;
&lt;P&gt;fs.writeFileSync(*filename*, body, {encoding: 'base64'});&lt;BR /&gt;This is the code I'm using to upload the file to Dropbox:&lt;/P&gt;
&lt;P&gt;body = Buffer.from(body).toString('base64');&lt;/P&gt;
&lt;P&gt;dbx.filesUpload({ contents: body, path: saveLocation + `/` + filename })&lt;BR /&gt;.then((response: any) =&amp;gt; {&lt;BR /&gt;console.log(`Saved file "${filename}" to Dropbox folder ${saveLocation}`);&lt;BR /&gt;}).catch((uploadErr: DropboxError&amp;lt;files.UploadError&amp;gt;) =&amp;gt; {&lt;BR /&gt;console.log(uploadErr);&lt;BR /&gt;});&lt;BR /&gt;This is how the Excel file should look, and looks on my local:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dropbox01.png" style="width: 789px;"&gt;&lt;img src="https://www.dropboxforum.com/t5/image/serverpage/image-id/20557iE55EF2520D27B493/image-size/large?v=v2&amp;amp;px=999" role="button" title="dropbox01.png" alt="dropbox01.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This is what happens when I open the Dropbox Excel file:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dropbox02.png" style="width: 999px;"&gt;&lt;img src="https://www.dropboxforum.com/t5/image/serverpage/image-id/20558iFDF439A04405D96C/image-size/large?v=v2&amp;amp;px=999" role="button" title="dropbox02.png" alt="dropbox02.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This is how the Dropbox file looks when I open it up in a text editor:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dropbox03.png" style="width: 999px;"&gt;&lt;img src="https://www.dropboxforum.com/t5/image/serverpage/image-id/20559i2C421F79D686C668/image-size/large?v=v2&amp;amp;px=999" role="button" title="dropbox03.png" alt="dropbox03.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I've tried various encoding combinations for Dropbox but none of them seem to work. &lt;A href="https://yesornogenerator.com/" target="_self"&gt;tell me what i should do&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 25 Jan 2021 08:09:02 GMT</pubDate>
    <dc:creator>annahernandez99</dc:creator>
    <dc:date>2021-01-25T08:09:02Z</dc:date>
    <item>
      <title>Excel files uploaded to Dropbox using Node.js SDK are invalid</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Excel-files-uploaded-to-Dropbox-using-Node-js-SDK-are-invalid/m-p/489738#M24520</link>
      <description>&lt;P&gt;I am trying to upload Excel files to Dropbox using the Node.js SDK (&lt;A href="https://github.com/dropbox/dropbox-sdk-js" target="_blank" rel="noopener"&gt;https://github.com/dropbox/dropbox-sdk-js&lt;/A&gt;). The files are received from JsReport, and are saved correctly when saved to my local disk. However, when uploading to Dropbox, the files end up long strings instead of Excel files.&lt;/P&gt;
&lt;P&gt;The body in this case is a string that gets encoded to base64. The filename is speedtest_daily_2021-01-15_test26.xlsx.&lt;/P&gt;
&lt;P&gt;This line writes the file successfully to my local drive:&lt;/P&gt;
&lt;P&gt;fs.writeFileSync(*filename*, body, {encoding: 'base64'});&lt;BR /&gt;This is the code I'm using to upload the file to Dropbox:&lt;/P&gt;
&lt;P&gt;body = Buffer.from(body).toString('base64');&lt;/P&gt;
&lt;P&gt;dbx.filesUpload({ contents: body, path: saveLocation + `/` + filename })&lt;BR /&gt;.then((response: any) =&amp;gt; {&lt;BR /&gt;console.log(`Saved file "${filename}" to Dropbox folder ${saveLocation}`);&lt;BR /&gt;}).catch((uploadErr: DropboxError&amp;lt;files.UploadError&amp;gt;) =&amp;gt; {&lt;BR /&gt;console.log(uploadErr);&lt;BR /&gt;});&lt;BR /&gt;This is how the Excel file should look, and looks on my local:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dropbox01.png" style="width: 789px;"&gt;&lt;img src="https://www.dropboxforum.com/t5/image/serverpage/image-id/20557iE55EF2520D27B493/image-size/large?v=v2&amp;amp;px=999" role="button" title="dropbox01.png" alt="dropbox01.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This is what happens when I open the Dropbox Excel file:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dropbox02.png" style="width: 999px;"&gt;&lt;img src="https://www.dropboxforum.com/t5/image/serverpage/image-id/20558iFDF439A04405D96C/image-size/large?v=v2&amp;amp;px=999" role="button" title="dropbox02.png" alt="dropbox02.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This is how the Dropbox file looks when I open it up in a text editor:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dropbox03.png" style="width: 999px;"&gt;&lt;img src="https://www.dropboxforum.com/t5/image/serverpage/image-id/20559i2C421F79D686C668/image-size/large?v=v2&amp;amp;px=999" role="button" title="dropbox03.png" alt="dropbox03.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I've tried various encoding combinations for Dropbox but none of them seem to work. &lt;A href="https://yesornogenerator.com/" target="_self"&gt;tell me what i should do&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jan 2021 08:09:02 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Excel-files-uploaded-to-Dropbox-using-Node-js-SDK-are-invalid/m-p/489738#M24520</guid>
      <dc:creator>annahernandez99</dc:creator>
      <dc:date>2021-01-25T08:09:02Z</dc:date>
    </item>
    <item>
      <title>Re: Excel files uploaded to Dropbox using Node.js SDK are invalid</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Excel-files-uploaded-to-Dropbox-using-Node-js-SDK-are-invalid/m-p/490267#M24527</link>
      <description>&lt;P&gt;When uploading files to Dropbox, you should upload the raw data itself, without any additional encoding. It appears you're uploading the data with base64 encoding in this case though, and so the uploaded data has that additional encoding. You should perform the upload without that base64 encoding.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's &lt;A href="https://github.com/dropbox/dropbox-sdk-js/blob/main/examples/javascript/node/upload.js" target="_self"&gt;an example of uploading a local file to&amp;nbsp;Dropbox using the&amp;nbsp;Dropbox API v2 JavaScript SDK in Node&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jan 2021 16:00:11 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Excel-files-uploaded-to-Dropbox-using-Node-js-SDK-are-invalid/m-p/490267#M24527</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2021-01-25T16:00:11Z</dc:date>
    </item>
  </channel>
</rss>

