【问题标题】:How to convert an Excel spreadsheet to a CSV file in React?如何在 React 中将 Excel 电子表格转换为 CSV 文件?
【发布时间】:2021-06-22 17:31:36
【问题描述】:

我正在我的 React 应用程序中创建一个文件上传系统,允许用户将 Excel 电子表格上传到 S3 存储桶,然后可以将其转换为 CSV。

const submitFile = (substring) => {
  const ReactS3Client = new S3(config);
  ReactS3Client.uploadFile(file, substring).then(data => {
    if (data.status === 204) {
      alert("File successfully uploaded");
    } else {
      alert("Something went wrong");
    }
  })
};

我想知道是否可以在将 Excel 电子表格文件上传到 S3 存储桶之前将其转换为 CSV 文件。我找不到太多关于这方面的信息,所以我不确定这是否可能。

【问题讨论】:

    标签: reactjs csv amazon-s3 file-conversion


    【解决方案1】:

    看起来 npm 包 xlsx 可能有一个实用工具可以做到这一点。

    看看XLSX.utils.sheet_to_csv util。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-05-04
      • 1970-01-01
      • 2018-01-17
      • 1970-01-01
      • 2021-05-27
      • 2020-07-19
      • 2020-01-06
      • 1970-01-01
      相关资源
      最近更新 更多