cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
We've been busy working on some major updates to the Community, so check out what's changing, what’s staying the same and what you can expect from the Dropbox Community right here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

I have a CSV file with headers/fields?

I have a CSV file with headers/fields?

Saikiran
Explorer | Level 3

 

OwnerId,FirstName,LastName,MailingStreet,MailingCity,MailingState,MailingPostalCode,MailingCountry,Phone,RecordTypeId,Email,Campaign,IF_Local_Leader__c
005A0000001EHjd,jan 16 test for ACTON,kumar,,,,,,,012A0000000K4y8IAC,Test10@gmail.com,701q0000000K2Us,TRUE
005A0000001EHjd,Jan 16 If local check,Kumat,,,,,,,012A0000000K4y8IAC,testiflocal@gmail.com,701q0000000K2Us,TRUE
005A0000001EHjd,gowtham,test,,,,,,,012A0000000K4y8IAC,testacton123@gmail.com,701q0000000K2Us,TRUE

 I have a CSV file with headers/fields as like above

 

but when i preview/open the file in the dropbox it is coming in different format?

like

{"type":"Buffer","data":[79,119,110,101,114,73,100,44,70,105,114,115,116,78,97,109,101,44,76,97,115,116,78,97,109,101,44,77,97,105,108,105,110,103,83,116,114,101,101,116,44,77,97,105,108,105,110,103,67,105,116,121,44,77,97,105,108,105,110,103]

 

 

scenario is like this?

1. I used dropbox API to connect from Nodejs.

2. successfully connected.

3. stored a file in Apps folder.

4. created a folder there.

5. drop some files(csv files) in that.

6. but when i try to open the csv files the format is completely changed ..

it is giving like

types: buffer

data: [,,,,,,]

 

....

 

Please hlep on this.

6 Replies 6

Greg-DB
Dropbox Staff
I'll be happy to help with any issues you're having with the Dropbox API, but I'll need some more information. Please reply with:

- the name and version of the SDK/library you are using, if any
- the relevant code snippet(s)

Saikiran
Explorer | Level 3

Thanks .

My sdk version 1.3.14

 

My code is given below, here am reading my local csv file and passing that value to the dropbox.

i.e, upload a csv file to dropbox.

 

var node_dropbox = require('node-dropbox');
var fs = require('fs');

 

var api = node_dropbox.api('<REDACTED>'); //my access token


var f = '/Users/saikiran/Downloads/ifg_localleader_contacts.csv'; // my local csv file
fs.readFile(f, function (err, data) {
if (err) { throw err; }

 

api.createFile('12.csv',data, function(err, res) {
console.log(err);
});
});



Steve M.
Dropbox Staff

I've redacted the access token in your previous post, but since it was visible for some time, you should really disable that access token to make sure no one else can access your account.

 

I believe the bug is in the node-dropbox library, which is written by a third-party. This line seems suspect: https://github.com/g33kidd/node-dropbox/blob/master/lib/node_dropbox.js#L96. I believe setting json to true means that the requests library attempts to JSON-serialize your Buffer. I would recommend setting that to false instead.

 

Note also that this library appears to still use API v1, which has been deprecated and is due to be fully turned off in June: https://blogs.dropbox.com/developers/2016/06/api-v1-deprecated/. You might prefer to use the official Dropbox JavaScript SDK, which uses API v2: https://github.com/dropbox/dropbox-sdk-js.

Steve M.
Dropbox Staff
Actually, I made an assumption about the library you're using... but I see that you said you were using version 1.3.14, but the library I mentioned has a current version of 0.1.8.

Could it be that you're using a different library?

Saikiran
Explorer | Level 3

Thanks Steve.

 

My issue is resolved with using dbox module in node.

 

Thanks for your time.

Steve M.
Dropbox Staff
It appears to me that the dbox module also uses the deprecated API v1. (If this code doesn't need to work past June, that's okay to ignore.)
Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Steve M. Dropbox Staff
  • User avatar
    Saikiran Explorer | Level 3
What do Dropbox user levels mean?