I'm struggling with reading data out of an Excel Worksheet after upgrading to Microsoft Graph .NET SDK to v5.
This code is working with v4 of the SDK:
WorkbookRange range = await client.Me
.Drive.Items[bookId]
.Workbook.Worksheets[tabId]
.Range("A1:XX1")
.Request()
.GetAsync(cancellation)
.ConfigureAwait(false);
var data = range.Text.Deserialize<List<List<string>>>()!;
After moving to v5, I am able to get the range, but Text
is always empty:
WorkbookRange? used = await client
.Drives["Me"].Items[bookId]
.Workbook.Worksheets[tabId]
.UsedRangeWithValuesOnly(true)
.GetAsync(cancellationToken: cancellation)
.ConfigureAwait(false);
WorkbookRange? range = await client
.Drives["Me"].Items[bookId]
.Workbook.Worksheets[tabId]
.RangeWithAddress("A1:XX1")
.GetAsync(cancellationToken: cancellation)
.ConfigureAwait(false);
How do I get data from these ranges?