我正在尝试使用Microsoft图形从Onedrive读取Excel文件的示例程序。下面是代码,
var graph = require('@microsoft/microsoft-graph-client');
module.exports = {
getExcelContent: async function (accessToken) {
const client = getAuthenticatedClient(accessToken);
try {
let events;
events = await client.api("/me/drive/items/3E8A3E1FFEFBEAA8!1052/workbook/worksheets('Sheet1')/usedRange")
.get();
return events;
}
catch (err) {
consol.log("getExcelContent Exception: " + err.message);
}
}
};
function getAuthenticatedClient(accessToken) {
// Initialize Graph client
const client = graph.Client.init({
// Use the provided access token to authenticate
// requests
authProvider: (done) => {
done(null, accessToken);
}
});
return client;
}
如果excel文件少于5行,则此程序可以正常运行,并且我将excel内容作为JSON获取。但是,如果excel有更多行,则此程序在此行之后不再继续执行。
events = await client.api("/me/drive/items/3E8A3E1FFEFBEAA8!1052/workbook/worksheets('Sheet1')/usedRange")
.get();
也不给出任何例外。请有人帮助我。