Sharepoint worksheet delay when accessing usedRange via Graph API
Hi,
Not sure if this is the correct area to ask about this issue. Please advise where I can submit this ticket.
When using the Microsoft Graph API to query the contents of a worksheet via the usedRange endpoint: https://learn.microsoft.com/en-us/graph/api/worksheet-usedrange?view=graph-rest-1.0&tabs=http
When I edit a cell on the spreadsheet via the browser app and then call that endpoint, the contents of that cell isn't present until after a small delay, usually around 5s. In the worksheet itself the header says that it has been saved, however that isn't immediately present when called via the endpoint.
Is there a method to guarantee that when calling the Graph API endpoint that I'm getting the absolute latest contents, or is there a way to force a save before querying for the contents of a worksheet?
Thanks, Owen
@owenzhangzhengzhong
Let me preface this by stating I'm not an expert in the Excel API space. I have encountered this scenario before while performing an ad hoc test. Here is what I'd look at:
I'd investigate using the etag property to determine whether the workbook has changed since that last access. https://learn.microsoft.com/en-us/graph/api/resources/driveitem?view=graph-rest-1.0
I also suggest you try using the Excel session. https://learn.microsoft.com/en-us/graph/api/resources/excel?view=graph-rest-1.0#sessions-and-persistence
I cannot guarantee that these will work. I don't think this API was designed with real-time co-authoring in mind.