# csf-utils

> Common Spreadsheet Format utilities

Latest version **1.2.0** (published 2017-06-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install csf-utils
pnpm add csf-utils
yarn add csf-utils
bun add csf-utils
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2017-06-03 |
| First published | 2017-05-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Eugene Nikitin |
| Maintainers | eunikitin |
| Keywords | common-spreadsheet-format, csf, spreadsheet, utils |

## Links

- npm: https://www.npmjs.com/package/csf-utils
- Repository: https://github.com/eunikitin/csf-utils
- Homepage: http://github.com/eunikitin/csf-utils.git
- Issues: http://github.com/eunikitin/csf-utils/issues
- npm.io page: https://npm.io/package/csf-utils

## Dependencies (3)

- [csf-convert](https://npm.io/package/csf-convert.md) ^1.1.3
- [excel-cell-parser](https://npm.io/package/excel-cell-parser.md) ^1.0.1
- [excel-column-name](https://npm.io/package/excel-column-name.md) ^1.0.0

## 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

- 1.2.0 (latest) — 2017-06-03
- 1.1.0 — 2017-06-02
- 1.0.0 — 2017-05-24

## README

# Common Spreadsheet Format utilities
[![Build Status](https://travis-ci.org/eunikitin/csf-utils.svg?branch=master)](https://travis-ci.org/eunikitin/csf-utils)
[![Coverage Status](https://coveralls.io/repos/github/eunikitin/csf-utils/badge.svg?branch=master)](https://coveralls.io/github/eunikitin/csf-utils?branch=master)
[![dependencies Status](https://david-dm.org/eunikitin/csf-utils/status.svg)](https://david-dm.org/eunikitin/csf-utils)
[![devDependencies Status](https://david-dm.org/eunikitin/csf-utils/dev-status.svg)](https://david-dm.org/eunikitin/csf-utils?type=dev)

Contains:
* [excel-column-name](https://www.npmjs.com/package/excel-column-name)
* [excel-cell-parser](https://www.npmjs.com/package/excel-cell-parser)
* [csf-convert](https://www.npmjs.com/package/csf-convert)

## Install
```npm install csf-utils```

## API

### parseCell(cell)

#### cell

**Required**

Type: string | object

```js
var csfUtils = require('csf-utils');

csfUtils.parseCell('A1'); // { row: 1, column: 1 } 
csfUtils.parseCell({ row: 1, column: 1 }); // A1
```

### columnName.intToExcelCol(column)

#### column

**Required**

Type: number

```js
var csfUtils = require('csf-utils');

csfUtils.columnName.intToExcelCol(1); // 'A' 
```

### columnName.excelColToInt(column)

#### column

**Required**

Type: string

```js
var csfUtils = require('csf-utils');

csfUtils.columnName.excelColToInt('A'); // 1 
```

### convert.sheetToAoa(data)

#### data

**Required**

Type: object

```js
var csfUtils = require('csf-utils');

var sheetData = {
  A1: { t: 's', v: 'A1' },
  C1: { t: 's', v: 'C1' },
  D1: { t: 's', v: 'D1' },
  E1: { t: 's', v: 'E1' },
  A2: { t: 's', v: 'A2' },
  B2: { t: 's', v: 'B2' },
  C2: { t: 's', v: 'C2' },
  E2: { t: 's', v: 'E2' },
  '!ref': 'A1:E2',
};

var aoa = csfUtils.convert.sheetToAoa(sheetData);
/* result:
[
  [
    { t: 's', v: 'A1' },
    undefined,
    { t: 's', v: 'C1' },
    { t: 's', v: 'D1' },
    { t: 's', v: 'E1' } ],
  [
    { t: 's', v: 'A2' },
    { t: 's', v: 'B2' },
    { t: 's', v: 'C2' },
    undefined,
    { t: 's', v: 'E2' }
  ]
]
 */
```

### convert.aoaToSheet(data)

#### data

**Required**

Type: Array

```js
var csfUtils = require('csf-utils');

var aoa = [
  [
    { t: 's', v: 'A1' },
    undefined,
    { t: 's', v: 'C1' },
    { t: 's', v: 'D1' },
    { t: 's', v: 'E1' } ],
  [
    { t: 's', v: 'A2' },
    { t: 's', v: 'B2' },
    { t: 's', v: 'C2' },
    undefined,
    { t: 's', v: 'E2' }
  ]
]

var sheetData = csfUtils.convert.aoaToSheet(sheetData);
/* result:
{
  A1: { t: 's', v: 'A1' },
  C1: { t: 's', v: 'C1' },
  D1: { t: 's', v: 'D1' },
  E1: { t: 's', v: 'E1' },
  A2: { t: 's', v: 'A2' },
  B2: { t: 's', v: 'B2' },
  C2: { t: 's', v: 'C2' },
  E2: { t: 's', v: 'E2' },
  '!ref': 'A1:E2',
}
 */
```

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