Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
smarta1
6 years agoExplorer | Level 3
load files whit excel vba
Hi.
I would like to receive an example on how to upload a file (ie *.xlsm) to dropbox from excel using vba.
Thanks a lot.
smarta1
6 years agoExplorer | Level 3
Hi Jay.
I asked because I found the following but I do not know if is complete:
Public Sub DB_PutFile(FileName As String)
Dim req As MSXML2.ServerXMLHTTP60
Dim strFile As String
Dim Pos1 As Integer
Dim Pos2 As Integer
Dim arg As String
Set req = New MSXML2.ServerXMLHTTP60
strFile= ReadBinary(FileName)
arg = "{""path"":""/" & FileName & """,""mode"":{"".tag"":""overwrite""},""autorename"":false,""mute"":true}"
req.Open "POST", "https://content.dropboxapi.com/2/files/upload", False
req.setRequestHeader "Authorization", "Bearer xxxxxxxxxxxxxxxx"
req.setRequestHeader "Content-Type", "application/octet-stream"
req.setRequestHeader "Content-length", Len(Result)
req.setRequestHeader "Dropbox-API-Arg", arg
req.setRequestHeader "User-Agent", "api-explorer-client"
req.send strFile
If req.Status = 200 Then
Debug.Print req.responseText
Else
'MsgBox req.Status & ": " & req.statusText
Debug.Print req.responseText
End If
End Sub
Can you help me?
Best regards.
Greg-DB
Dropbox Community Moderator
6 years agosmarta1 The Dropbox API does offer the ability to programmatically upload files, such as by using /2/files/upload as referenced in the code you shared. Please refer to the documentation linked there for information on using that.
Give that a try and if something on the API isn't working expected, please share the error/output.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!