Sep 19 2023 07:20 PM
I have an issue when I try to read a specific workbook in Excel using pandas read_excel()
The following code was tested natively and it worked:
import pandas as pd
pth = "C:/Users/XXXX/Python 101/SUBPATH/"
input = "inputworkbook.xlsx"
wb = pth + input
df1 = pd.read_excel(wb, sheet_name="Sheet1", skiprows=1)
When I try to execute it from an excel workbook, I got this error message :
FileNotFoundError: [Errno 2] No such file or directory:
'C:/Users/XXXX/Python 101/SUBPATH/inputworkbook.xlsx'
Could you explain me why it doesn't work the same ? (Thanks)
Sep 24 2023 09:46 AM
Thanks for your reply. It is unfortunate. Do you know the reason why ?
Python is easier (more flexible) than Power Query for ETL (from my point of view).
Sep 25 2023 02:47 AM
SolutionThat's data security, more details in related post.
I don't think that's a big issue. You may Power Query external file (or any other source) and do nothing with it, just save as connection only. Next on Python
df=xl("MyConnectionName")
and do all transformations with Python.
Sep 25 2023 06:14 AM
Sep 25 2023 06:28 AM
It works. Some initial transformation in Power Query could be useful, e.g. "Use first row as header" if you load from csv or unstructured sheet.
Sep 26 2023 01:56 AM
Sep 26 2023 03:03 AM
@Jeanbar99 , you are welcome
Dec 29 2023 12:47 AM
In my case it is a big issue) Power Query doesn't see difference between hidden and unhidden rows in excel files, however pandas.read_excel can do that. And I hoped that introducing Pandas in Excel would enable this functionality.
Dec 29 2023 03:21 AM
Not sure. At least now pandas in Excel work with values, not with properties.
Sep 25 2023 02:47 AM
SolutionThat's data security, more details in related post.
I don't think that's a big issue. You may Power Query external file (or any other source) and do nothing with it, just save as connection only. Next on Python
df=xl("MyConnectionName")
and do all transformations with Python.