Forum Discussion
Error while reading XLSX file into dataframe using pandas
- 1 year ago
No it didn't help. I have changed my source file type to json now and after that I am not facing any Unauthorization issue
Hi Arundhati_Sen1,
Thank you for reaching out to the Microsoft Forum Community. Thank you FabianSchut, for your input on this issue.
Thank you for providing detailed information about the issue you’re facing. Based on your description and the discussion with the superuser, here’s a comprehensive solution to address the intermittent ClientAuthenticationError: Unauthorized issue when reading XLSX files from your Lakehouse:
- Please ensure that the authentication token has a sufficiently long expiration time and is set to refresh automatically if required. If you are using the DefaultAzureCredential or a custom authentication mechanism, confirm the token's expiry and refresh it proactively.
- Although you have confirmed that the XLSX file is closed when the issue arises, please ensure that no other processes are accessing or modifying the file at the same time.
- Please verify your configuration settings to confirm they are correctly set up for authentication.
If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly.
Thank you.
- Arundhati_Sen11 year agoFrequent Visitor
Hi v-saisrao-msft
I am following https://www.youtube.com/watch?v=sjCDtDHej90&t=144s which shows how to read excel file from lakehouse
Normally reading the file from lakehouse :pd.read_excel(mapping_file_path, header=0, sheet_name=0, dtype=str)
Regarding below points, how do I do that? Can you share any example for below please:- Please ensure that the authentication token has a sufficiently long expiration time and is set to refresh automatically if required. If you are using the DefaultAzureCredential or a custom authentication mechanism, confirm the token's expiry and refresh it proactively.
- Please verify your configuration settings to confirm they are correctly set up for authentication.
- v-saisrao-msft1 year agoCommunity Support
Hi Arundhati_Sen1,
- Authentication tokens expire after a set period (usually 1 hour), which can cause issues in long-running or idle processes. DefaultAzureCredential should automatically handle token renewal if implemented correctly. For custom authentication, check and refresh the token before it expires. If using a service principal, ensure periodic token refresh to maintain continuous access.
- Make sure your user account or service principal has the required roles, like Storage Blob Data Reader for read access or Storage Blob Data Contributor for read/write access. Confirm that the abfss:// path is correctly formatted and points to the correct file in the Lakehouse.
If this post helps, then please give us ‘Kudos’ and consider accepting it as a solution to help other members find it more quickly.
Thank you.
- v-saisrao-msft1 year agoCommunity Support
Hi Arundhati_Sen1,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you. - v-saisrao-msft1 year agoCommunity Support
Hi Arundhati_Sen1,
We haven’t heard back from you regarding your issue. If it has been resolved, please mark the helpful response as the solution and give a ‘Kudos’ to assist others. If you still need support, let us know.
Thank you.