1.1.3 • Published 7 years ago

csf-convert v1.1.3

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

Common Spreadsheet Format convert utilities

Build Status Coverage Status dependencies Status devDependencies Status

Install

npm install csf-convert

API

sheetToAoa(data)

data

Required

Type: object

var convert = require('csf-convert');

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 = 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' }
  ]
]
 */

aoaToSheet(data)

data

Required

Type: Array

var convert = require('csf-convert');

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 = 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',
}
 */
1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago