Forum Discussion
Connecting to data source hosted on Dropbox
@@JAkerblo, are you using api v1 or v2?
I cannot insert the list_folder code in the other web queries from the other posts.
Could you please send an example of your working code?
Sorry Anonymous! The example I used to implement this was a company production report. I'd have to make a test example, but I can do it with a little spare time today or tomorrow if you're still stuck.
It is api v2. My instructions tell you to get the access token via the API Explorer link on the home page of dropbox.com/developers. Ctrl+F your way to "list_folder" and click on Get Token and follow the instructions to get a token for what you need. In my situation I have both a personal account and a company one, so I have to choose before I can generate a token.
After that you have the query step in powerbi desktop. This line is all you need and then you can go on and navigate to the excel sheets you're interested in. Nothing else.
= Excel.Workbook(Web.Contents("https://api-content.dropbox.com/1/files/auto/<PATH FROM DROPBOX ROOT TO EXCEL OF INTEREST>/<EXCEL FILENAME>?access_token=<ACCESS TOKEN GENERATED FOR THE DROPBOX ROOT YOU'RE IN>"), null, true)"So in context, my M code looks like:
let
Source = Excel.Workbook(Web.Contents("https://api-content.dropbox.com/1/files/auto/<PATH FROM DROPBOX ROOT TO EXCEL OF INTEREST>/<EXCEL FILENAME>?access_token=<ACCESS TOKEN GENERATED FOR THE DROPBOX ROOT YOU'RE IN>"), null, true),
Assignments_Sheet = Source{[Item="Assignments",Kind="Sheet"]}[Data],
#"Promoted Headers" = Table.PromoteHeaders(Assignments_Sheet, [PromoteAllScalars=true]),
and so on...