Reputation: 1257
https://myshare.sharepoint.com/:x:/s/software/Mks12aSccSS-bsaSJdBFBc1dkns?e=QeL6At
This is URL I copied from browser (It's just example). How I can use NodeJS to read content from it ??
Any idea?
Upvotes: 0
Views: 4123
Reputation: 430
you can use npm node-sp-auth (npmjs.com/package/node-sp-auth) to authorize Sharepoint and then use npm sp-download ( npmjs.com/package/sp-download) to download the xls file to a local ( temporary) location.
Then you use npm 'xlsx' ( https://www.npmjs.com/package/xlsx) to read xlsx file contents. It gives access to the workbook, sheets and sheet content as JSON
const workbook = XLSX.readFile( 'tmpfile.xlsx');
const sheets = workbook.sheetNames;
// get content for first sheet
const sheetContent = XLSX.utils.sheet_to_json(workbook.Sheets[sheets[0]]);
Upvotes: 6