# table-to-csv

> 把table表格下载为csv格式的文件

Latest version **0.1.1** (published 2021-09-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install table-to-csv
pnpm add table-to-csv
yarn add table-to-csv
bun add table-to-csv
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2021-09-07 |
| First published | 2021-08-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | yyl |
| Maintainers | yanyalong |
| Keywords | table-download, csv |

## Links

- npm: https://www.npmjs.com/package/table-to-csv
- Repository: https://github.com/YalongYan/downlaod-table-to-csv
- Homepage: https://www.cnblogs.com/yalong/p/15214644.html
- Issues: https://github.com/YalongYan/downlaod-table-to-csv/issues
- npm.io page: https://npm.io/package/table-to-csv

## Alternatives

- [csv-to-markdown-table](https://npm.io/package/csv-to-markdown-table.md) — 47.0K weekly downloads
- [@sapphire/ratelimits](https://npm.io/package/@sapphire/ratelimits.md) — 4.4K weekly downloads
- [js-csvparser](https://npm.io/package/js-csvparser.md) — 2.0K weekly downloads
- [@adadapted/js-sdk](https://npm.io/package/@adadapted/js-sdk.md) — 251 weekly downloads
- [@grapecity/spread-sheets-sparklines](https://npm.io/package/@grapecity/spread-sheets-sparklines.md) — 103 weekly downloads

## Recent versions

- 0.1.1 (latest) — 2021-09-07
- 0.1.0 — 2021-09-01
- 0.0.8 — 2021-09-01
- 0.0.7 — 2021-09-01
- 0.0.6 — 2021-09-01
- 0.0.5 — 2021-08-31
- 0.0.4 — 2021-08-31
- 0.0.3 — 2021-08-31
- 0.0.2 — 2021-08-31
- 0.0.1 — 2021-08-31

## README

#### 环境说明：
该组件是原生js编写，支持`typescript`; 在浏览器环境中使用，不区分 `vue`, `react`等框架环境
#### 详细说明:
[https://www.cnblogs.com/yalong/p/15214644.html](https://www.cnblogs.com/yalong/p/15214644.html)
#### 安装
`npm i table-to-csv -S`
#### 使用示例
```
import TableToCsv from 'table-to-csv';
const initColumns = [
  {
    dataIndex: "Index",
    key: "Index",
    title: "序号",
  },
  {
    dataIndex: "userid",
    key: "userid",
    title: "用户Uid",
  },
  {
    dataIndex: "score",
    key: "score",
    title: "收益点",
  }
 ]
 const initList = [
    {
      id: '32',
      Index: 1,
      userid: '11',
      score: '10'
    },
    {
      id: '42'
      Index: 2,
      userid: '22',
      score: '20'
    },
    {
      id: '89',
      Index: 3,
      userid: '33',
      score: '30'
    }
  ];

 TableToCsv(initColumns, initList, '统计表格')
```
#### 说明：
- `initColumns` 就是 table 列的数据
- `initList` 就是 table 的展示数据
- 第三个参数就是下载文件的名字
- `initColumns` 里面`key` 和 `dataIndex` 必须有一个

---
_Source: https://npm.io/package/table-to-csv · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
