• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member
  • Login

Using Dropbox with Power Query|General Excel Questions & Answers|Excel Forum|My Online Training Hub

You are here: Home / Using Dropbox with Power Query|General Excel Questions & Answers|Excel Forum|My Online Training Hub

office scripts course

Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search
Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search Search
sp_RankInfo
Lost password?
sp_CrumbsHome HomeExcel ForumGeneral Excel Questions & Answe…Using Dropbox with Power Query
sp_PrintTopic sp_TopicIcon
Using Dropbox with Power Query
Avatar
Rajeev Arora

New Member
Members
Level 0
Forum Posts: 2
Member Since:
November 28, 2019
sp_UserOfflineSmall Offline
1
November 28, 2019 - 1:18 am
sp_Permalink sp_Print

Hi. First Post!

I use Dropbox for all my files, and across all my team. 

I recently set up a spreadsheet using Power Queries on my laptop at home with all the necessary files stored in one folder. 

However the location of the files at work is a bit different because Dropbox resides on a different drive. So the power query links are broken. 

Is there a way to link files that are stored in Dropbox so that they will work in multiple locations?

Thanks in advance!

Raj

sp_AnswersTopicSeeAnswer See Answer
Avatar
Catalin Bombea
Iasi, Romania
Admin
Level 10
Forum Posts: 1844
Member Since:
November 8, 2013
sp_UserOfflineSmall Offline
2
November 28, 2019 - 4:28 am
sp_Permalink sp_Print sp_EditHistory

Hi Rajeev,

When dropbox is installed, a json file is created in AppData folder, you can extract the dropbox path from that file using a simple code that can be found online.

The json looks like :

{"personal": {"path": "E:\\Dropbox", "host": xxxxxx, "is_team": false, "subscription_type": "Basic"}}

For dropbox business, the json has also the business details.

Public Function DropboxPath() As String
Dim RegEx As Object, MatchColl As Object, DataLine As String
Dim FileNum As Integer: FileNum = FreeFile
Set RegEx = CreateObject("VBScript.RegExp")
RegEx.Global = True
RegEx.IgnoreCase = False
Open Environ("LOCALAPPDATA") & "\Dropbox\info.json" For Input As #FileNum
DataLine = Input(LOF(FileNum), #FileNum)
Close #FileNum
RegEx.Pattern = "^.*""path"": ""([^""]*).*"
DropboxPath = Replace(RegEx.Replace(DataLine, "$1"), "\\", "\")
End Function

You can even get data from that simple json using text functions.

With this function, you can put the put in a table that is used by your query.

sp_AnswersTopicAnswer
Answers Post
Avatar
Rajeev Arora

New Member
Members
Level 0
Forum Posts: 2
Member Since:
November 28, 2019
sp_UserOfflineSmall Offline
3
December 2, 2019 - 7:35 am
sp_Permalink sp_Print

Brilliant! Thank you!

Avatar
Jim Chen
Member
Members

Power BI
Level 0
Forum Posts: 64
Member Since:
February 20, 2019
sp_UserOfflineSmall Offline
4
December 3, 2019 - 1:44 am
sp_Permalink sp_Print

Catalin,

Sorry that I don't quite understand. I have the same scenarios as I saved files/folders under the Dropbox folder with different drives, at home and atand work. 

How can insert my folder path or file path into the code and pale it as the source of Power Query? Assuming that

the folder path is: dropbox/a../b../c../XXXXXX (XXXXXis the folder name);

the file path is: dropbox/x../y../z../BBBBB (BBBBB is the file name);

I hope that I make my questions clear to you.

 

Thanks,

 

Brent

Avatar
Catalin Bombea
Iasi, Romania
Admin
Level 10
Forum Posts: 1844
Member Since:
November 8, 2013
sp_UserOfflineSmall Offline
5
December 3, 2019 - 3:44 am
sp_Permalink sp_Print sp_EditHistory

Hi Jim/Brent,

You should have a table with 1 column and 1 row, the table name will be SourceFolder:

Source Folder
E:\Dropbox

The value in this cell From Source Folder column should be written by a vb code called at workbook_open event.

The following code should be placed into ThisWorkbook vb module:

Private Sub Workbook_Open()
ThisWorkbook.Worksheets("Settings").ListObjects("SourceFolder").Range.Cells(1).Offset(1, 0).Value = DropBoxPath
End Sub

The function provided above should be in a normal vb module.

In your query, you can refer to this cell like this:

Folder= Excel.CurrentWorkbook(){[Name="SourceFolder"]}[Content]{0}[Source Folder],

Source = Folder.Files(Folder),

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Leigh Thomas
Guest(s) 9
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 880
Purfleet: 414
Frans Visser: 346
David_Ng: 306
lea cohen: 237
Jessica Stewart: 219
A.Maurizio: 213
Aye Mu: 201
jaryszek: 183
Newest Members:
Trevor Pindling
Stevan Kanjo
Erin Sheldon
Nikita Bhatia
Sheilah Taylor
Clare Webber
David Jenssen
Dominic Brosnahan
Young You
Jennifer Owens
Forum Stats:
Groups: 3
Forums: 24
Topics: 6524
Posts: 28554

 

Member Stats:
Guest Posters: 49
Members: 32808
Moderators: 2
Admins: 4
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea, FT
Moderators: Velouria, Riny van Eekelen
© Simple:Press —sp_Information

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel Office Scripts
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook

Sign up to our newsletter and join over 400,000
others who learn Excel and Power BI with us.

 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate
  • Sponsor Our Newsletter

Support

  • Contact
  • Forum
  • Helpdesk - For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.