I am trying to read and update an Excel file stored in OneDrive using the Microsoft Graph API. However, I consistently encounter the following error:
ERROR:root:Request failed: {"error":{"code":"ItemNotFound","message":"The requested resource doesn't exist.","innerError":{"code":"itemNotFound","message":"The requested resource doesn't exist.","date":"2025-01-18T22:20:58","request-id":"d908b11c-edcc-4a73-9383-2ca4328c3f4a","client-request-id":"d908b11c-edcc-4a73-9383-2ca4328c3f4a"}}}
Steps I Took
- I retrieved the file ID using the Microsoft Graph API's /drive/root/children endpoint.
- File ID returned: 1555B702B0C2A00A!s86e7ed45f177405ba089286bc4cc00af
I verified that the file exists in my OneDrive account and is accessible.
I used the correct API endpoint to access the workbook, for example:
.0/me/drive/items/1555B702B0C2A00A!s86e7ed45f177405ba089286bc4cc00af/workbook/worksheets/Sheet1/range(address='A1:B2')
I ensured the Microsoft Graph permissions are correctly configured:
- Scopes: Files.ReadWrite, offline_access, Sites.ReadWrite.All
- I also checked that the file is synced and accessible from my OneDrive folder.
What could cause the ItemNotFound error for a file that exists and is accessible via OneDrive?
I am trying to read and update an Excel file stored in OneDrive using the Microsoft Graph API. However, I consistently encounter the following error:
ERROR:root:Request failed: {"error":{"code":"ItemNotFound","message":"The requested resource doesn't exist.","innerError":{"code":"itemNotFound","message":"The requested resource doesn't exist.","date":"2025-01-18T22:20:58","request-id":"d908b11c-edcc-4a73-9383-2ca4328c3f4a","client-request-id":"d908b11c-edcc-4a73-9383-2ca4328c3f4a"}}}
Steps I Took
- I retrieved the file ID using the Microsoft Graph API's /drive/root/children endpoint.
- File ID returned: 1555B702B0C2A00A!s86e7ed45f177405ba089286bc4cc00af
I verified that the file exists in my OneDrive account and is accessible.
I used the correct API endpoint to access the workbook, for example:
https://graph.microsoft.com/v1.0/me/drive/items/1555B702B0C2A00A!s86e7ed45f177405ba089286bc4cc00af/workbook/worksheets/Sheet1/range(address='A1:B2')
I ensured the Microsoft Graph permissions are correctly configured:
- Scopes: Files.ReadWrite, offline_access, Sites.ReadWrite.All
- I also checked that the file is synced and accessible from my OneDrive folder.
What could cause the ItemNotFound error for a file that exists and is accessible via OneDrive?
Share Improve this question edited Jan 18 at 23:49 Rui Sousa asked Jan 18 at 23:32 Rui SousaRui Sousa 571 silver badge9 bronze badges 1- Can you at least point out why are you down voting the question? – Rui Sousa Commented Jan 22 at 11:37
1 Answer
Reset to default 0In my case the issue was with the sheet names. I was using different sheet name with no spaces in in it when they had spaces. Please keep in mind that the message "The requested resource doesn't exist" doesn't always mean the id of the file is incorrect buy if the sheet name is incorrect it might also happen.