1

If I manually grant access to a file, my code is able to open the document in subsequent runs. I will be working with new files each day so I would like to eliminate the grant access pop up window. I've tried sudo python myscript.py, but it doesn't resolve the issue.

While the open() function is able to open the file, I want to be able to use the range style referencing available in xlwings.

Will you please tell me how to grant Python (or just my script), not only to the individual files that are currently in the folder but also any files which get added to a folder in the future?

chckfx
  • 31
  • 3

2 Answers2

4

The issue you're seeing has nothing to do with Python or xlwings, but is really a "feature" of Excel 2016 on Mac: It is sandboxed and thus cannot access files outside of the app's directory, see this answer and this tutorial.

Community
  • 1
  • 1
Felix Zumstein
  • 6,737
  • 1
  • 30
  • 62
  • Thank you for your answer. I wish you were wrong, but nothing I have been able to find disagrees. This is deeply disappointing. The first answer won't help me when there are new files each day, the second looks painful but I'll give it a try. – chckfx Sep 26 '16 at 19:57
  • I save file here: "~/Library/Containers/com.microsoft.Excel/Data" to get around that issue. – Felix Zumstein Sep 27 '16 at 09:49
3

To revive this thread for Office 365 and Catalina: it is still necessary to save Excel files here:

~/Library/Containers/com.microsoft.Excel/Data

to avoid the prompt for granting access.

or to this folder generally for Office files:

~/Library/Group\ Containers/UBF8T346G9.Office
bunher
  • 111
  • 6