Office365-REST-Python-Client icon indicating copy to clipboard operation
Office365-REST-Python-Client copied to clipboard

Range method returns null

Open michaljan opened this issue 3 months ago • 0 comments

Hello,

Name: Office365-REST-Python-Client Version: 2.6.2

I have started using GraphClient lately for API connection and run into issue with 'range' method.

import  adal
from office365.graph_client import GraphClient
from office365.onedrive.workbooks.ranges.range import WorkbookRange`

def acquire_token_func():
    # Removed auth details
    return token
# Using office365.graph_client package
client = GraphClient(acquire_token_func,tenant_name)
site = client.sites["xxx"].get().execute_query()
file_item = site.drive.root.get_by_path('root_book.xlsx').get().execute_query()
workbook = file_item.workbook

print("Creating a session...")
result = workbook.create_session().execute_query()

print("Reading a table...")
table = workbook.worksheets["Test_sheet"].tables["Table1"]
# read table content
rows = table.rows.get().execute_query()
for r in rows:
    print(r.values)

This works as expected returning array. But any interaction with range method returns null

print("Reading range...")
range: WorkbookRange = workbook.worksheets["Sheet1"].range(address="A1:B3").get().execute_query()
print(range.values)

Result null

Amending code print(range) returns Sheet1!1:1048576

I have followed example here

Can you please advise if its user error or a bug.

Thank you, Michal

michaljan avatar Sep 12 '25 09:09 michaljan