python-o365 icon indicating copy to clipboard operation
python-o365 copied to clipboard

Unable to do basic Excel operations

Open Kornosky opened this issue 2 years ago • 2 comments

Hello! I haven't seen anyone else run into this issue, but no matter what I do I can't get past this error when trying to do simple actions like "get_row". I'm stumped on how to fix it. Main error: Error Message: The API you are trying to use could not be found. It may be available in a newer version of Excel. Full Error:

Traceback (most recent call last):
  File "c:/Users/chris/Desktop/DeleteMe/TestCSVTeams/from O365.excel import WorkBook-bak.py", line 130, in <module>
    main()
  File "c:/Users/chris/Desktop/DeleteMe/TestCSVTeams/from O365.excel import WorkBook-bak.py", line 103, in main
    print(table.get_row_at_index(0))
  File "C:\Users\chris\AppData\Local\Programs\Python\Python36-32\lib\site-packages\O365\excel.py", line 1337, in get_row_at_index
    response = self.session.post(url, data={'index': index})
  File "C:\Users\chris\AppData\Local\Programs\Python\Python36-32\lib\site-packages\O365\excel.py", line 142, in post
    return self.con.post(*args, **kwargs)
  File "C:\Users\chris\AppData\Local\Programs\Python\Python36-32\lib\site-packages\O365\connection.py", line 822, in post
    return self.oauth_request(url, 'post', data=data, **kwargs)
  File "C:\Users\chris\AppData\Local\Programs\Python\Python36-32\lib\site-packages\O365\connection.py", line 800, in oauth_request
    return self._internal_request(self.session, url, method, **kwargs)
  File "C:\Users\chris\AppData\Local\Programs\Python\Python36-32\lib\site-packages\O365\connection.py", line 762, in _internal_request
    raise HTTPError('{} | Error Message: {}'.format(e.args[0], error_message), response=response) from None
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://graph.microsoft.com/v1.0//sites/ingenuitystudios.sharepoint.com,848918bb-a883-46f6-aef1-cbe5b280ea3b,7f75c326-8f37-40d5-bfa7-a65d8d15bb99/drive/items/01EQNU4RSWNGPJNAXPRFCKZ5XFIKTUROZB/workbook/tables('%7BE38B7FFA-E744-4C91-8A89-EE8FDF860C26%7D')/rows/itemAt | Error Message: The API you are trying to use could not be found. It may be available in a newer version of Excel. Please refer to the documentation: "https://docs.microsoft.com/office/dev/add-ins/reference/requirement-sets/excel-api-requirement-sets". 

Kornosky avatar Jun 20 '22 22:06 Kornosky

I don't know what happens here. It worked before. I don't have the time right now to check this nor fix it. I'll label this as a bug for the moment.

alejcas avatar Jul 11 '22 09:07 alejcas

Hey @Kornosky ,

  • Could you please share example of a code you use?
  • Also how do you install the package?
  • What version do you use?

I'd like to try to reproduce your issue, Thanks

stanislau-arkhipenka avatar Jul 11 '22 14:07 stanislau-arkhipenka

I have this issue but on row.update()

table = ws.get_table('table')
rows = table.get_rows()

for row in rows:
    pprint(row.values)
    row.update([['test', 'test2', 'a', 'b', 'c', 'd']])

output:

[['My, 'test', values'', 'x', 'x', 'x']]
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://graph.microsoft.com/beta/users/{account}/drives/{drive_id}/items/{item_id}/workbook/worksheets('{ws_id}')/tables({table_id})/rows/0 | Error Message: De API die u probeert te gebruiken, is niet gevonden. Het is mogelijk beschikbaar in een nieuwere versie van Excel. Raadpleeg de documentatie: "https://docs.microsoft.com/office/dev/add-ins/reference/requirement-sets/excel-api-requirement-sets".

jeroenvermunt avatar Sep 26 '22 19:09 jeroenvermunt

possible solution mentioned here: https://stackoverflow.com/questions/65210929/ms-graph-api-update-tablerow-fail-for-400-client-error-bad-request-for-url

jeroenvermunt avatar Sep 26 '22 19:09 jeroenvermunt