Git Product home page Git Product logo

Comments (5)

ysguy avatar ysguy commented on June 9, 2024

Resolved. Thanks for being my Rubber Duckie. Changing my code to not persist immediately resolves it. Sorry for missing this important information.

The Fix:
od_excel_file = WorkBook(XLfile, use_session=False, persist=False)

from python-o365.

ysguy avatar ysguy commented on June 9, 2024

Reopening issue. It works randomly, but a majority of the time it still gives the 404 error with the use_session and persist false values.

How to test. Make one python or two python scripts that attach to an excel on onedrive and sharepoint doc libraries. Call one, then the other. The error will appear.

from python-o365.

alejcas avatar alejcas commented on June 9, 2024

Can I see the error messages? I don't know what's happening and I don't know If I will be able to fix it

from python-o365.

parkus83 avatar parkus83 commented on June 9, 2024

Hello everyone, I have the same problem. I am trying to modify an Excel file on SharePoint, and I can access it using ysguy's workaround (od_excel_file = WorkBook(XLfile, use_session=False, persist=False). However, when I try to access the sheets, columns, or individual rows, it gives me this error again:

requests.exceptions.HTTPError: 404 Client Error: Not Found for the URL:
https://graph.microsoft.com/v1.0/me/drive/items/01GOIU2PSQMCWJ47LBVRA33LRPXUHQCGDK/workbook/worksheets/MIGRATION
Error Message: The resource could not be found.

if I check the link provided above I retrieve a weird token error:

{
error: {
code: "InvalidAuthenticationToken",
message: "Access token is empty.",
innerError: {
date: "2024-02-05T10:52:47",
request-id: "c989ec4f-1cf9-4c8b-9de0-92692a141602",
client-request-id: "c989ec4f-1cf9-4c8b-9de0-92692a141602"
}
}
}

ps: I have used the following method to authenticate my application. And it return the default_storage correctly.

def access_sharepoint_drive() -> Drive:
    """
    Access sharepoint drive
    :return: sharepoint drive
    """
    credentials = (os.environ.get("CLIENT_ID_SHAREPOINT"), os.environ.get("CLIENT_SECRET_SHAREPOINT"))

    account = Account(credentials)
    
    # used only for the first time
    # scopes = ['basic', 'Files.ReadWrite.All', 'Files.Read.All']
    # if account.authenticate(scopes=scopes):
    #   logging.info("Authenticated to sharepoint")

    storage = account.storage()

    return storage.get_default_drive()

from python-o365.

alejcas avatar alejcas commented on June 9, 2024

Hi I don't have the time to investigate this atm.

If you want to, a good start are ms graph docs:

https://learn.microsoft.com/en-us/graph/api/resources/excel?view=graph-rest-1.0

from python-o365.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.