Home Reference Source
import {File} from 'better-xlsx/src/file.js'
public class | source

File

This is the main class, use it:

import { File } from 'better-xlsx';
const file = new File();
const sheet = file.addSheet('Sheet-1');

Member Summary

Private Members
private
private

sheet: *

private

sheets: *

private

styles: *

Method Summary

Public Methods
public

Add a new Sheet, with the provided name, to a File

public

saveAs(type: String, compress: Boolean): Promise | stream

Save the File to an xlsx file.

Private Methods
private

Private Members

private definedNames: * source

private sheet: * source

private sheets: * source

private styles: * source

Public Methods

public addSheet(name: String): Sheet source

Add a new Sheet, with the provided name, to a File

Params:

NameTypeAttributeDescription
name String

Name of the Sheet

Return:

Sheet

public saveAs(type: String, compress: Boolean): Promise | stream source

Save the File to an xlsx file.

Params:

NameTypeAttributeDescription
type String
  • optional
  • default: 'nodebuffer'

For Node.js use nodebuffer and browser use blob or base64.

compress Boolean
  • optional
  • default: false

For file compression.

Return:

Promise | stream

For Node.js return stream and browser return Promise.

Private Methods

private makeParts(): Object source

Return:

Object

XML files mapping object