Reputation: 79
I have an excel workbook containing a table that is linked to numerous Data Source files via PowerQuery. There is a high likelihood that the a user will be in the Data Source files updating them. Is it possible for me to refresh my table using powerquery whilst the Data Source Files are open by another user. I keep getting the message:
[DataSource.Error] The process cannot access the file '......' because it is being used by another process.
Upvotes: 1
Views: 3832
Reputation: 21
After a lot of trial & error and a lot of Grace I worked out following workaround that really works regardless of OneDrive synchronization status.
Explainer of the situation: When OneDrive for Desktop is synchronizing an Excel workbook (let's call it Data Workbook), and that workbook is trying to be accessed from another workbook (let's call it Analysis Workbook) via PowerQuery or even directly by regular pivot table (not even PowerPivot) - Excel will regularly throw out error The process cannot access the file because it is being used by another process. That happens because the import/reading mechanism wants exclusive access to the Data Workbook (even though it is reading it only). You can't do a thing about it.
Workaround: You have to "fool" the import mechanism into thinking it is not accessing another workbook. There is a good enough solution for this which can be applied and automated in most situations:
This successfully circumvents any and all issues with OneDrive. Details on the example of using regular pivot table as the data consumer in Analysis workbook:
Notes:
Upvotes: 0
Reputation: 511
I found this topic when trying to work out how to do the same thing. Just in case anyone finds this in the future, I'll mention how I applied MarcelBeug's solution.
Code was this
let Source = Folder.Files("MyFilePathHere\"),
#"Added Custom" = Table.AddColumn(Source, "Custom", each
Excel.Workbook([Content],true)),
Changed to
let Source = Folder.Files("MyFilePathHere\"),
#"Filtered Rows1" = Table.SelectRows(Source, each not Text.StartsWith([Name], "~$")),
#"Added Custom" = Table.AddColumn(#"Filtered Rows1", "Custom", each
Excel.Workbook([Content],true)),
I made the change via the GUI editor using a Text Filter on the file name. The filter was 'does not begin with' and the value was '~$'.
Upvotes: 0