# How to fix "DataSource.Error Access to the path '/yourpath.csv' is denied error" in macOS Excel Power Query excel error box: [DataSource.Error] Access to the path '/Users/dan/Dropbox/mybook/mydata.csv' is denied. One of the most incomprehensible errors I have ever run into, with Microsoft forums and ChatGPT/Claude being almost totally useless. Hopefully anyone else running into this situation will come across this gist and save themselves hours of frustration. Huge thanks to [Mr. Excel for the solution](https://youtu.be/chBlyDrejHo?si=JoWYoPGkQSE24_fN&t=369), with a major assist by [r/excel](https://www.reddit.com/r/excel/comments/17euyxj/datasourceerror_mac_powerquery_driving_me_nuts/) ## Background power query editor error [DataSource.Error] Access to the path '/Users/dan/Dropbox/mybook/mydata.csv' is denied. So you're trying to use macOS Excel's Power Query Editor to load an external file from disk, e.g. `/Users/dan/Dropbox/mybook/mydata.csv`, only to get this error: ``` • [DataSource.Error] Access to the path '/Users/dan/Dropbox/mybook/mydata.csv' is denied. Details isRecoverable: True isExpected: True ``` I ran into this error when saving a workbook on Dropbox, and then trying to open and work on it from a different laptop. Opening the Excel workbook was fine, the error message came from the Power Query command that imported the CSV, e.g. ```pq let Source = Csv.Document( File.Contents("/Users/dan/Dropbox/mybook/mydata.csv"), [Delimiter = ",", Columns = 2, QuoteStyle = QuoteStyle.None] ) in Source ``` The computer that originally created and saved the workbook had no problems re-opening the book and working with the Power Query command. The other laptop just utterly refused to open the CSV. Even after granting Full Disk Access via macOS Settings » Privacy and Security options. ## Solution tl;dr: Have Excel ask you to grant access to that file. But since Excel (in my experience) won't even know to do that, you can force it to with a simple VB command referencing the file path. ### 1. Force Excel to ask for access privileges by executing VB code that refers to the file path Go to the Microsoft Visual Basic editor inside of Excel (i.e. Developer ribbon » Visual Basic) excel screenshot of VB editor Then open up the "Immediate" code window, i.e. **View » Immediate Window** or use the keyboard shortcut Ctrl-Cmd-G. Enter, then execute following benign code which simply tries to print the directory of the data file via a message alert box: *(obviously, replace with the absolute path to the file you're trying to access)* ````vb MsgBox Dir("/Users/dan/Dropbox/mybook/mydata.csv") ```` image Executing that line of code will bring up a dialog box asking you to manually grant access to the given file. > Additional permissions are required to access the following files: > /Users/dan/Dropbox/mybook/mydata.csv > Microsoft Excel needs access to the file named "mydata.csv". Select the item to grant access. image Select the file and grant access: image It will likely ask you to grant access to the enclosing folder, so do that too: image The `MsgBox` command should successfully execute: image Save, and restart Excel. You should be good to go. **Note:** You have to completely exit out of Excel, not just close the file. ### Also: Enable "Allow combining data from multiple sources" You already need to do this step anyway, whether you're on macOS or Windows: In the Power Query Editor » Options » **Privacy**, be sure to enable the option that says: > Allow combining data from multiple sources. This could expose sensitive or confidential data to an unauthorized person. image ## References - [MrExcel.com Excel for Mac - Power Query Three Missing Connector Workarounds - Episode 2597](https://youtu.be/chBlyDrejHo?si=JoWYoPGkQSE24_fN&t=369) (6 minute mark) - r/excel: [DataSource.Error (mac, powerquery) driving me nuts](https://www.reddit.com/r/excel/comments/17euyxj/datasourceerror_mac_powerquery_driving_me_nuts/)