Edit: I deleted this but I'm going to undelete because I think it could be useful. And post what was actually happening which I didn't realize at the time.
Original Question: I'm trying to open a set of excel files where one is currently open by another user. All of the other files work, but this one I get 'permission denied' errors.
Windows gives you the option to "read only" open the file, but I can't seem to find an equivalent in python (xlrd), so I thought I would copy the file to a temp location and open it; but that doesn't work either. In either case, i get:
IOError: [Errno 13] Permission denied:
Is it possible to either:
- open an excel file in read only mode (like windows) in xlrd
- copy a file currently in use by another user
thanks !
As it turns out, I the files that were failing were also open by other users, so when I went to access them through windows explorer it seemed natural another user having the file open would cause the permission denied error; however the real issue is that as I was looping through the folder I was attempting to access the temp files created by Excel for the other user who was accessing the file.
So, for a given file "old_file.xlsx" that a user had open, their instance of excel created "~$old_file.xlsx"
How I got around this was:
basically, just making sure that they're the non-temp, xlsx files that I planned to go through.