Skip to content

Commit

Permalink
worksheet range fix
Browse files Browse the repository at this point in the history
  • Loading branch information
vgrem committed Jan 21, 2024
1 parent 5985120 commit d025c1e
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
10 changes: 6 additions & 4 deletions examples/onedrive/excel/read_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@
import sys

from office365.graph_client import GraphClient
from tests.graph_case import acquire_token_by_username_password
from tests import test_client_id, test_password, test_tenant, test_username

client = GraphClient(acquire_token_by_username_password)
client = GraphClient.with_username_and_password(
test_tenant, test_client_id, test_username, test_password
)
drive_item = client.me.drive.root.get_by_path("Financial Sample.xlsx")
worksheets = drive_item.workbook.worksheets.get().execute_query()
if len(worksheets) == 0:
sys.exit("No worksheets found")

# worksheet_range = worksheets["Sheet1"].range().execute_query()
worksheet_range = worksheets["Sheet1"].range(address="A2:P10").execute_query()
print(worksheet_range)
worksheet_range = worksheets["Sheet1"].range(address="A1:B3").execute_query()
print(worksheet_range.values)
4 changes: 4 additions & 0 deletions generator/metadata/MicrosoftGraph.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6134,6 +6134,9 @@
<Annotations Target="microsoft.graph.educationSubmission/unsubmittedDateTime">
<Annotation Term="Org.OData.Core.V1.Computed" Bool="true"/>
</Annotations>
<Annotations Target="microsoft.graph.educationSubmission/webUrl">
<Annotation Term="Org.OData.Core.V1.Computed" Bool="true"/>
</Annotations>
<Annotations Target="microsoft.graph.subscription">
<Annotation Term="Org.OData.Capabilities.V1.CountRestrictions">
<Record>
Expand Down Expand Up @@ -24575,6 +24578,7 @@
<Property Name="submittedDateTime" Type="Edm.DateTimeOffset"/>
<Property Name="unsubmittedBy" Type="graph.identitySet"/>
<Property Name="unsubmittedDateTime" Type="Edm.DateTimeOffset"/>
<Property Name="webUrl" Type="Edm.String"/>
<NavigationProperty Name="outcomes" Type="Collection(graph.educationOutcome)" ContainsTarget="true"/>
<NavigationProperty Name="resources" Type="Collection(graph.educationSubmissionResource)" ContainsTarget="true"/>
<NavigationProperty Name="submittedResources" Type="Collection(graph.educationSubmissionResource)" ContainsTarget="true"/>
Expand Down
2 changes: 1 addition & 1 deletion office365/runtime/client_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def __init__(self, context, resource_path=None, parent_collection=None):
self._entity_type_name = None
self._resource_path = resource_path

def clear(self):
def clear_state(self):
# type: () -> Self
"""Resets client object's state."""
self._properties = {
Expand Down
2 changes: 1 addition & 1 deletion office365/runtime/client_object_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def __init__(self, context, item_type, resource_path=None, parent=None):
self._next_request_url = None
self._parent = parent

def clear(self):
def clear_state(self):
"""Clears client object collection"""
if not self._paged_mode:
self._data = []
Expand Down
2 changes: 1 addition & 1 deletion office365/runtime/odata/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def process_response(self, response, query):
return

if isinstance(return_type, ClientObject):
return_type.clear()
return_type.clear_state()

if (
response.headers.get("Content-Type", "").lower().split(";")[0]
Expand Down

0 comments on commit d025c1e

Please sign in to comment.