I'm working on pulling data from an excel file saved on SharePoint Document Library. I'm getting the rows and I'm confused at the data structure. I'm still fairly new to typscript/javascript.
I'm getting the rows back:
private _getRows(documentLibraryID: string, documentID: string, worksheet: string, table: string): Promise<[MicrosoftGraph.WorkbookTableRow]> {
return new Promise<any>((resolve, reject) => {
this.props.context.msGraphClientFactory
.getClient()
.then((client: MSGraphClient): void => {
client
.api(`/sites/${URL}/drives/${documentLibraryID}/items/${documentID}/workbook/worksheets('${worksheet}')/Tables('${table}')/rows`)
.get((error, response: any, rawResponse?: any) => {
if (response) {
let rows:[MicrosoftGraph.WorkbookTableRow] = response.value;
resolve(rows);
}
else {
reject(error);
}
});
});
});
}
What I get back:
I try to enumerate through the arrays:
for (let row of rows) {
console.log("row: ", row);
for (let value of row.values) {
console.log("value: ", value);
for (let newValue of value.values) {
console.log("newValue: ", newValue);
}
}
}
But I don't get to the newValue
object:
What don't I understand about this structure? It looks like 3 nested arrays.