• 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
    • Password Reset
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member
You are here: Home
Lost password?
sp_Search
Advanced Search
Advanced Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search

Please confirm you want to mark all posts read

Mark all topics read

sp_MobileMenu Actions
Actions
sp_LogInOut
Log In
sp_Search

Search Forums

sp_RankInfo
Ranks Information
Avatar

New/Updated Topics

General Excel Questions & Answers

  Amortization

  Customer Order From Facebook Page.

  Grey out master list when selected in dropdown

Dashboards & Charts

  Connecting 2 separate pivot charts or data sets to calculate…

VBA & Macros

  Send Email Code Error

  Direccionar de un rango a una celda especifica

  how can i add windows media player in excel 2016

  Changing shape colours

Power Query

  Unpivoting data

Power Query

  pq_7.01_parameter_tables

Power BI

  How identify the URL to connect power bi with Project online

Excel Expert

  new and deleted entries

  Excel Dashboard

Select Forum

  Rules and Guides

Forum Rules and Guides

  Public Forums - For Registered Users

General Excel Questions & Answers

Dashboards & Charts

VBA & Macros

Power Query

Power Pivot

  Course Members Only

Excel Dashboards

Power Query

Power Pivot

Xtreme Pivot Tables

Excel for Decision Making

Excel for Finance

Power BI

Excel

Word

Outlook

Excel Expert

Excel for Customer Service Professionals

Excel Analysis Toolpak

Excel Tables

Excel for Operations Management

Financial Modelling

Advanced Excel Formulas

Pivot Tables Quick Start

ForumsGeneral Excel Questions &…
sp_TopicIcon
Using Dropbox with Power Query
Avatar
Rajeev Arora
Posts: 2

Level 0
November 28, 2019 - 1:18 am

1

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
Avatar
Catalin Bombea
Iasi, Romania
Posts: 1807
Level 10
November 28, 2019 - 4:28 am

2

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
Avatar
Rajeev Arora
Posts: 2

Level 0
December 2, 2019 - 7:35 am

3

Brilliant! Thank you!

Avatar
Jim Chen
Posts: 53
Level 0
December 3, 2019 - 1:44 am

4

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
Posts: 1807
Level 10
December 3, 2019 - 3:44 am

5

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),

Forum Timezone:
Australia/Brisbane
Most Users Ever Online: 245
Currently Online: baber Tufail
Guest(s) 10
Currently Browsing this Page:
1 Guest(s)

Devices in use: Desktop (6), Phone (5)

Forum Stats:
Groups: 3
Forums: 24
Topics: 6205
Posts: 27211
Member Stats:
Guest Posters: 49
Members: 31880
Moderators: 3
Admins: 4
© Simple:Press

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • 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
 

Company

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

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.