What is the recommended approach to determine the completion status of workbook calculations using the Microsoft Graph API?

Kewley, Mark 0 Reputation points
2023-08-01T19:42:04.35+00:00

Dear Support,

Our current integration with Excel workbooks utilizes a read-only session during the reading and writing process. We have developed our Python application to employ this approach effectively, as shown in the examples below.

E.g.

endpoint = f"{self.config['graph_url']}/me/drive/items/{workbook_id}/workbook/createSession"payload = {"persistChanges": False}

We then include the workbook-session-id on all subsequent requests in the headers

Sample write:

    endpoint = f"/me/drive/items/{workbook_id}/workbook/worksheets/{worksheet_name}/range(address='{address}')"
    url = f"{conf['graph_url']}{endpoint}"
    resp = _request_with_retry(
        method="PATCH",
        url=url,
        headers=conf["headers"],
        json_payload=params,
    )
    return resp.json()

Sample Read:

    range_dat = basic_request(
        conf=conf,
        endpoint=f"/me/drive/items/{workbook_id}/workbook/worksheets/{worksheet_name}/range(address='{address}')"
    )

However, we've observed an intermittent issue where, approximately 2% of the time, the data fetched by the subsequent read operation appears to be incomplete or still in the calculation phase. This generally occurs just after writing data to the workbook.

Though introducing a delay or re-running the operation seems to resolve the issue, we'd prefer a more reliable and efficient solution.

Is there an available API call or method we can use to determine whether the workbook calculations are complete? This would help ensure data integrity and improve the overall reliability of our application.

We appreciate your guidance and look forward to your response.

Best Regards,

  • Mark
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,457 questions
{count} votes