Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read values from a Workbook range #745

Closed
kellerza opened this issue Oct 3, 2023 · 1 comment
Closed

Read values from a Workbook range #745

kellerza opened this issue Oct 3, 2023 · 1 comment

Comments

@kellerza
Copy link
Contributor

kellerza commented Oct 3, 2023

How would one get the cell values from a range in the GraphClient?

The workbook only allows access to named-ranges or tables

class Workbook(Entity):
    """The top-level object that contains related workbook objects such as worksheets, tables, and ranges."""

The WorkbookWorksheet also seems to lack any range property

A direct call to MS graph would be:

https://graph.microsoft.com/v1.0/sites/__siteId__/lists/__listId__/items/__itemId__/driveitem/workbook/worksheets('Sheet1')/range(address='B4:N1000')?select=values
@vgrem
Copy link
Owner

vgrem commented Jan 21, 2024

Greetings,

a new version (2.5.5) has been released with a better support for Range in OneDrive API, here is an example:

client = GraphClient.with_username_and_password(
    tenant_name, client_id, username, password
)
drive_item = client.me.drive.root.get_by_path("Financial Report.xlsx")
worksheet_range = drive_item.workbook.worksheets["Sheet1"].range(address="A1:B3").execute_query()

@vgrem vgrem closed this as completed Jan 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants