Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to update Table Row Values

I am attempting to update a table using a python library to iterate through the table rows.

I get this error: "Error Message: The API you are trying to use could not be found. It may be available in a newer version of Excel."

Adding rows succeeds, but any APIs on the rows endpoint doesn't work, I can't get range or update a row. I even tried going directly to requests to have more control over what gets passed. I tried both the v1.0 and beta endpoints as well.

https://learn.microsoft.com/en-us/graph/api/tablerow-update?view=graph-rest-1.0&tabs=http

Here is the URL Endpoint I am calling: https://{redacted}/items/{file_id}/workbook/tables/Table1/rows/0

Any help is appreciated.

Update to add code (you have to have an existing authenticated requests session to run it in python):

data = {'values': [5, 6, 7]}

kwargs = {
    'data': json.dumps(data),
    'headers': {
        'workbook-session-id': workbook.session.session_id,
        'Content-type': 'application/json'}}

# Works
sharepoint = 'onevmw.sharepoint.com,***REDACTED***'
drive = '***REDACTED***'
item = '****REDACTED***'
base_url = f'https://graph.microsoft.com/v1.0//sites/{sharepoint}/drives/{drive}/items/{item}'
get_url = f"{base_url}/workbook/tables/{test_table.name}/rows"
session = office_connection.account.connection.get_session(load_token=True)
get_response: requests.Response = session.request(method='get', url=get_url)
print(get_response.text)

# Doesn't work
url = f"{base_url}/workbook/tables/{test_table.name}/rows/1"
response: requests.Response = session.request(method='patch', url=url, **kwargs)
print(response.text)
like image 440
Adam Logan Avatar asked Oct 27 '25 07:10

Adam Logan


1 Answers

That's an issue. Unfortunately it not documented at the moment in the offical documentation.

I could make it work by changing the url from ".../rows/1" as ".../rows/itemAt(index=1)"

like image 200
Amandeep Chugh Avatar answered Oct 29 '25 09:10

Amandeep Chugh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!