[python-win32] pywin can not access excel file
Dennis Lee Bieber
wlfraed at ix.netcom.com
Mon Dec 13 07:34:18 EST 2021
On Sun, 12 Dec 2021 08:32:01 +0000, Tamara Abugharbieh
<Tamara.Abugharbieh at Realsoft-me.com> declaimed the following:
>filename = 'C:\\\\App\\\\Backend\\\\public\\\\MSB_2021\\\\11\\\\SYB_10_7_V1.xlsx'
>
That looks like an awful lot of \s.
Unless you are passing that string to a command line/shell, the Windows
API itself is happy with single /s (which avoids any problem of needing to
escape \s to avoid some combos being treated as special characters).
>ExcelApp = w3c.DispatchEx("Excel.Application")
>ExcelApp.Visible = False
>ExcelApp.DisplayAlerts = False
>wb = ExcelApp.Workbooks.Open("{0}".format(fileName))
As has been mentioned, filename and fileName aren't the same entity
(though the error message does reference the string you provided, so
something is not the code you actually ran).
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed at ix.netcom.com http://wlfraed.microdiversity.freeddns.org/
More information about the python-win32
mailing list