开发者

Unable to read file from S3 url

开发者 https://www.devze.com 2022-12-07 18:44 出处:网络
I have excel file stored in S3 bucket fro where I am storing the file url inside mongodb.I want to read data from this excel file and transform into JSON.So for that I am XLSX package but it is not re

I have excel file stored in S3 bucket fro where I am storing the file url inside mongodb.I want to read data from this excel file and transform into JSON.So for that I am XLSX package but it is not reading the file as I am passing the file url inside the method,

Below is my code:

try {

    const data = await productSchema.findOne({ report_id: reportId });

    if (data) {

        console.log(data.me_url); //I am getting the file url

        const file = xlsx.readFile(data.me_url);
        const sheetNames = file.SheetNames;
      开发者_如何学Python  const totalSheets = sheetNames.length;

        console.log(sheetNames);
        console.log(totalSheets);
    }
}
catch (err) {
    return err;
}

Any idea why it is not reading the file or anyhthing I have missed.

0

精彩评论

暂无评论...
验证码 换一张
取 消