Home

Awesome

view on npm npm module downloads per month Build Status Dependency Status

xlsx-populate

Excel XLSX parser/generator written in JavaScript with Node.js and browser support, jQuery/d3-style method chaining, encryption, and a focus on keeping existing workbook features and styles in tact.

Table of Contents

Installation

Node.js

npm install xlsx-populate

Note that xlsx-populate uses ES6 features so only Node.js v4+ is supported.

Browser

A functional browser example can be found in examples/browser/index.html.

xlsx-populate is written first for Node.js. We use browserify and babelify to transpile and pack up the module for use in the browser.

You have a number of options to include the code in the browser. You can download the combined, minified code from the browser directory in this repository or you can install with bower:

bower install xlsx-populate

After including the module in the browser, it is available globally as XlsxPopulate.

Alternatively, you can require this module using browserify. Since xlsx-populate uses ES6 features, you will also need to use babelify with babel-preset-env.

Usage

xlsx-populate has an extensive API for working with Excel workbooks. This section reviews the most common functions and use cases. Examples can also be found in the examples directory of the source code.

Populating Data

To populate data in a workbook, you first load one (either blank, from data, or from file). Then you can access sheets and cells within the workbook to manipulate them.

const XlsxPopulate = require('xlsx-populate');

// Load a new blank workbook
XlsxPopulate.fromBlankAsync()
    .then(workbook => {
        // Modify the workbook.
        workbook.sheet("Sheet1").cell("A1").value("This is neat!");

        // Write to file.
        return workbook.toFileAsync("./out.xlsx");
    });

Parsing Data

You can pull data out of existing workbooks using Cell.value as a getter without any arguments:

const XlsxPopulate = require('xlsx-populate');

// Load an existing workbook
XlsxPopulate.fromFileAsync("./Book1.xlsx")
    .then(workbook => {
        // Modify the workbook.
        const value = workbook.sheet("Sheet1").cell("A1").value();

        // Log the value.
        console.log(value);
    });

Note: in cells that contain values calculated by formulas, Excel will store the calculated value in the workbook. The value method will return the value of the cells at the time the workbook was saved. xlsx-populate will not recalculate the values as you manipulate the workbook and will not write the values to the output.

Ranges

xlsx-populate also supports ranges of cells to allow parsing/manipulation of multiple cells at once.

const r = workbook.sheet(0).range("A1:C3");

// Set all cell values to the same value:
r.value(5);

// Set the values using a 2D array:
r.value([
    [1, 2, 3],
    [4, 5, 6],
    [7, 8, 9]
]);

// Set the values using a callback function:
r.value((cell, ri, ci, range) => Math.random());

A common use case is to simply pull all of the values out all at once. You can easily do that with the Sheet.usedRange method.

// Get 2D array of all values in the worksheet.
const values = workbook.sheet("Sheet1").usedRange().value();

Alternatively, you can set the values in a range with only the top-left cell in the range:

workbook.sheet(0).cell("A1").value([
    [1, 2, 3],
    [4, 5, 6],
    [7, 8, 9]
]);

The set range is returned.

Rows and Columns

You can access rows and columns in order to change size, hide/show, or access cells within:

// Get the B column, set its width and unhide it (assuming it was hidden).
sheet.column("B").width(25).hidden(false);

const cell = sheet.row(5).cell(3); // Returns the cell at C5.

Managing Sheets

xlsx-populate supports a number of options for managing sheets.

You can get a sheet by name or index or get all of the sheets as an array:

// Get sheet by index
const sheet1 = workbook.sheet(0);

// Get sheet by name
const sheet2 = workbook.sheet("Sheet2");

// Get all sheets as an array
const sheets = workbook.sheets();

You can add new sheets:

// Add a new sheet named 'New 1' at the end of the workbook
const newSheet1 = workbook.addSheet('New 1');

// Add a new sheet named 'New 2' at index 1 (0-based)
const newSheet2 = workbook.addSheet('New 2', 1);

// Add a new sheet named 'New 3' before the sheet named 'Sheet1'
const newSheet3 = workbook.addSheet('New 3', 'Sheet1');

// Add a new sheet named 'New 4' before the sheet named 'Sheet1' using a Sheet reference.
const sheet = workbook.sheet('Sheet1');
const newSheet4 = workbook.addSheet('New 4', sheet);

Note: the sheet rename method does not rename references to the sheet so formulas, etc. can be broken. Use with caution!

You can rename sheets:

// Rename the first sheet.
const sheet = workbook.sheet(0).name("new sheet name");

You can move sheets:

// Move 'Sheet1' to the end
workbook.moveSheet("Sheet1");

// Move 'Sheet1' to index 2
workbook.moveSheet("Sheet1", 2);

// Move 'Sheet1' before 'Sheet2'
workbook.moveSheet("Sheet1", "Sheet2");

The above methods can all use sheet references instead of names as well. And you can also move a sheet using a method on the sheet:

// Move the sheet before 'Sheet2'
sheet.move("Sheet2");

You can delete sheets:

// Delete 'Sheet1'
workbook.deleteSheet("Sheet1");

// Delete sheet with index 2
workbook.deleteSheet(2);

// Delete from sheet reference
workbook.sheet(0).delete();

You can get/set the active sheet:

// Get the active sheet
const sheet = workbook.activeSheet();

// Check if the current sheet is active
sheet.active() // returns true or false

// Activate the sheet
sheet.active(true);

// Or from the workbook
workbook.activeSheet("Sheet2");

Defined Names

Excel supports creating defined names that refer to addresses, formulas, or constants. These defined names can be scoped to the entire workbook or just individual sheets. xlsx-populate supports looking up defined names that refer to cells or ranges. (Dereferencing other names will result in an error.) Defined names are particularly useful if you are populating data into a known template. Then you do not need to know the exact location.

// Look up workbook-scoped name and set the value to 5.
workbook.definedName("some name").value(5);

// Look of a name scoped to the first sheet and set the value to "foo".
workbook.sheet(0).definedName("some other name").value("foo");

You can also create, modify, or delete defined names:

// Create/modify a workbook-scope defined name
workbook.definedName("some name", "TRUE");

// Delete a sheet-scoped defined name:
workbook.sheet(0).definedName("some name", null);

Find and Replace

You can search for occurrences of text in cells within the workbook or sheets and optionally replace them.

// Find all occurrences of the text "foo" in the workbook and replace with "bar".
workbook.find("foo", "bar"); // Returns array of matched cells

// Find the matches but don't replace.
workbook.find("foo");

// Just look in the first sheet.
workbook.sheet(0).find("foo");

// Check if a particular cell matches the value.
workbook.sheet("Sheet1").cell("A1").find("foo"); // Returns true or false

Like String.replace, the find method can also take a RegExp search pattern and replace can take a function callback:

// Use a RegExp to replace all lowercase letters with uppercase
workbook.find(/[a-z]+/g, match => match.toUpperCase());

Styles

xlsx-populate supports a wide range of cell formatting. See the Style Reference for the various options.

To get/set a cell style:

// Get a single style
const bold = cell.style("bold"); // true

// Get multiple styles
const styles = cell.style(["bold", "italic"]); // { bold: true, italic: true }

// Set a single style
cell.style("bold", true);

// Set multiple styles
cell.style({ bold: true, italic: true });

Similarly for ranges:

// Set all cells in range with a single style
range.style("bold", true);

// Set with a 2D array
range.style("bold", [[true, false], [false, true]]);

// Set with a callback function
range.style("bold", (cell, ri, ci, range) => Math.random() > 0.5);

// Set multiple styles using any combination
range.style({
    bold: true,
    italic: [[true, false], [false, true]],
    underline: (cell, ri, ci, range) => Math.random() > 0.5
});

If you are setting styles for many cells, performance is far better if you set for an entire row or column:

// Set a single style
sheet.row(1).style("bold", true);

// Set multiple styles
sheet.column("A").style({ bold: true, italic: true });

// Get a single style
const bold = sheet.column(3).style("bold");

// Get multiple styles
const styles = sheet.row(5).style(["bold", "italic"]);

Note that the row/column style behavior mirrors Excel. Setting a style on a column will apply that style to all existing cells and any new cells that are populated. Getting the row/column style will return only the styles that have been applied to the entire row/column, not the styles of every cell in the row or column.

Some styles take values that are more complex objects:

cell.style("fill", {
    type: "pattern",
    pattern: "darkDown",
    foreground: {
        rgb: "ff0000"
    },
    background: {
        theme: 3,
        tint: 0.4
    }
});

There are often shortcuts for the setters, but the getters will always return the full objects:

cell.style("fill", "0000ff");

const fill = cell.style("fill");
/*
fill is now set to:
{
    type: "solid",
    color: {
        rgb: "0000ff"
    }
}
*/

Number formats are one of the most common styles. They can be set using the numberFormat style.

cell.style("numberFormat", "0.00");

Information on how number format codes work can be found here. You can also look up the desired format code in Excel:

Rich Texts

You can read/write rich texts to cells.

Supported styles

bold, italic, underline, strikethrough, subscript, fontSize, fontFamily, fontGenericFamily, fontScheme, fontColor. See the Style Reference for the various options.

Usage

You can read and modify rich texts on an existing rich text cell:

// assume A1 is a rich text cell
const RichText = require('xlsx-Populate').RichText;
const cell = workbook.sheet(0).cell('A1');
cell.value() instanceof RichText // returns true
const richtext = cell.value();
// get the concatenate text
richtext.text();

// loop through each rich text fragment
for (let i = 0; i < richtext.length; i++) {
    const fragment = richtext.get(i);
    // Get the style
    fragment.style('bold');
    // Get many styles
    fragment.style(['bold', 'italic']);
    // Set one style
    fragment.style('bold', true);
    // Set many styles
    fragment.style({ 'bold': true, 'italic': true });
    // Get the value
    fragment.value();
    // Set the value
    fragment.value('hello');
}

// remove the first rich text fragment
richtext.remove(0);

// clear this rich texts
richtext.clear();

How to set a cell to rich texts:

const RichText = require('xlsx-Populate').RichText;
const cell = workbook.sheet(0).cell('A1');
// set a cell value to rich text
cell.value(new RichText());

// add two rich text fragments
cell.value()
    .add('hello ', { italic: true, bold: true })
    .add('world!', { fontColor: 'FF0000' });

You can specify the index when adding rich text fragment.

// add before the first fragment
cell.value().add('text', { bold: true }, 0);
// add before the second fragment
cell.value().add('text', { bold: true }, 1);
// add after the last fragment
cell.value().add('text', { bold: true });

Notes

We make a deep copy of the richtext instance when assign it to a cell, which means you can only modify the content of the richtext before calling cell.value(richtext). Any modification to the richtext instance after calling cell.value(richtext) will not save to the cell. i.e.

const richtext = new RichText();
richtext.add('hello');
cell.value(richtext);
cell.value().text(); // returns 'hello'

richtext.add(' world')
richtext.text(); // returns 'hello world' 
cell.value().text(); // returns 'hello'
cell.value() === richtext; // returns false

cell.value().add(' world');
cell.value().text(); // returns 'hello world'

This means you can create a rich text instance and assign it to any cells! Each cell does not share the same instance but creates a deep copy of the instance.

const sheet = workbook.sheet(0);
const richtext = new RichText();
richtext.add('hello');
const range = sheet.range("A1:C3");
range.value(richtext);
// they do not share the same instance
sheet.cell('A1').value() === sheet.cell('C1').value() // returns false

You can get the rich text from a cell and set it to anoher cell.

const richtext = cell1.value();
cell2.value(richtext);
cell1.value() === cell2.value() // returns false

Whenever you call richtext.add(text, styles, index), we will detect if the given text contains line separators (\n, \r, \r\n), if it does, we will call cell.style('wrapText', true) for you. MS Excel needs wrapText to be true to have the new lines displayed, otherwise you will see the texts in one line. You may also need to set row height to have all lines displayed.

cell.value()
    // it support all line separators
    .add('123\n456\r789\r\n10', { italic: true, fontColor: '123456' })
// remember to set height to show the whole row
workbook.sheet(0).row(1).height(100);

Dates

Excel stores date/times as the number of days since 1/1/1900 (sort of). It just applies a number formatting to make the number appear as a date. So to set a date value, you will need to also set a number format for a date if one doesn't already exist in the cell:

cell.value(new Date(2017, 1, 22)).style("numberFormat", "dddd, mmmm dd, yyyy");

When fetching the value of the cell, it will be returned as a number. To convert it to a date use XlsxPopulate.numberToDate:

const num = cell.value(); // 42788
const date = XlsxPopulate.numberToDate(num); // Wed Feb 22 2017 00:00:00 GMT-0500 (Eastern Standard Time)

Data Validation

Data validation is also supported. To set/get/remove a cell data validation:

// Set the data validation
cell.dataValidation({
    type: 'list',
    allowBlank: false,
    showInputMessage: false,
    prompt: false,
    promptTitle: 'String',
    showErrorMessage: false,
    error: 'String',
    errorTitle: 'String',
    operator: 'String',
    formula1: '$A:$A',//Required
    formula2: 'String'
});

//Here is a short version of the one above.
cell.dataValidation('$A:$A');

// Get the data validation
const obj = cell.dataValidation(); // Returns an object

// Remove the data validation
cell.dataValidation(null); //Returns the cell

Similarly for ranges:


// Set all cells in range with a single shared data validation
range.dataValidation({
    type: 'list',
    allowBlank: false,
    showInputMessage: false,
    prompt: false,
    promptTitle: 'String',
    showErrorMessage: false,
    error: 'String',
    errorTitle: 'String',
    operator: 'String',
    formula1: 'Item1,Item2,Item3,Item4',//Required
    formula2: 'String'
});

//Here is a short version of the one above.
range.dataValidation('Item1,Item2,Item3,Item4');

// Get the data validation
const obj = range.dataValidation(); // Returns an object

// Remove the data validation
range.dataValidation(null); //Returns the Range

Please note, the data validation gets applied to the entire range, not each Cell in the range.

Method Chaining

xlsx-populate uses method-chaining similar to that found in jQuery and d3. This lets you construct large chains of setters as desired:

workbook
    .sheet(0)
        .cell("A1")
            .value("foo")
            .style("bold", true)
        .relativeCell(1, 0)
            .formula("A1")
            .style("italic", true)
.workbook()
    .sheet(1)
        .range("A1:B3")
            .value(5)
        .cell(0, 0)
            .style("underline", "double");

Hyperlinks

Hyperlinks are also supported on cells using the Cell.hyperlink method. The method will not style the content to look like a hyperlink. You must do that yourself:

// Set a hyperlink
cell.value("Link Text")
    .style({ fontColor: "0563c1", underline: true })
    .hyperlink("http://example.com");

// Set a hyperlink with tooltip
cell.value("Link Text")
    .style({ fontColor: "0563c1", underline: true })
    .hyperlink({ hyperlink: "http://example.com", tooltip: "example.com" });

// Get the hyperlink
const value = cell.hyperlink(); // Returns 'http://example.com'

// Set a hyperlink to email
cell.value("Click to Email Jeff Bezos")
    .hyperlink({ email: "jeff@amazon.com", emailSubject: "I know you're a busy man Jeff, but..." });

// Set a hyperlink to an internal cell using an address string.
cell.value("Click to go to an internal cell")
    .hyperlink("Sheet2!A1");

// Set a hyperlink to an internal cell using a cell object.
cell.value("Click to go to an internal cell")
    .hyperlink(workbook.sheet(0).cell("A1"));

Print Options

Print options are accessed using the Sheet.printOptions method. Defaults are all assumed to be false, so if the attribute is missing, then the method returns false. A method Sheet.printGridLines is provided to offer the convenience of setting both gridLines and gridLinesSet.

// Print row and column headings
sheet.printOptions('headings', true);

// Get the headings flag
const headings = sheet.printOptions('headings'); // Returns true

// Clear flag for center on page vertically when printing
sheet.printOptions('verticalCentered', undefined);

// Get the verticalCentered flag
const verticalCentered = sheet.printOptions('verticalCentered'); // Returns false

// Enable grid lines in print
sheet.printGridLines(true);

// Now both gridLines and gridLinesSet print options are set
sheet.printOptions('gridLines') === sheet.printOptions('gridLinesSet') === true; // Returns true

// To disable, just disable one of gridLines or gridLinesSet
sheet.printOptions('gridLineSets', false);

const isPrintGridLinesEnabled = sheet.printGridLines(); // Returns false

Page Margins

Excel requires that all page margins are defined or none at all. To ensure this, please choose an existing or custom preset. See Sheet.pageMarginsPreset.

// Get the current preset
sheet.pageMarginsPreset(); // Returns undefined

// Switch to an existing preset
sheet.pageMarginsPreset('normal');

Page margins are accessed using the Sheet.pageMargins method. If a page margin is not set, the preset will fill in the gaps.

// Get top margin in inches, note that the current preset is currently set to normal (see above)
sheet.pageMargins('top'); // Returns 0.75

// Set top page margin in inches
sheet.pageMargins('top', 1.1);

// Get top page margin in inches.
const topPageMarginInInches = sheet.pageMargins('top'); // Returns 1.1

SheetView Panes

SheetView Panes are accessed using the Sheet.panes method. For convenience, we have Sheet.freezePanes, Sheet.splitPanes, Sheet.resetPanes, and type PaneOptions.

// access Pane options
sheet.panes(); // return PaneOptions Object

// manually Set Pane options, WARNING: setting wrong options may result in excel fails to open.
const paneOptions = { state: 'frozen', topLeftCell: 'B2', xSplit: 1, ySplit: 1, activePane: 'bottomRight' }
sheet.panes(paneOptions); // return PaneOptions Object

// freeze panes (freeze first column and first two rows)
sheet.freezePanes(1, 2);
// OR
sheet.freezePanes('B3');

// split panes (Horizontal Split Position: 1000 / 20 pt, Vertical Split Position: 2000 / 20 pt)
sheet.splitPanes(1000, 2000);

// reset to normal panes (no freeze panes and split panes)
sheet.resetPanes();

Serving from Express

You can serve the workbook from express or other web servers with something like this:

router.get("/download", function (req, res, next) {
    // Open the workbook.
    XlsxPopulate.fromFileAsync("input.xlsx")
        .then(workbook => {
            // Make edits.
            workbook.sheet(0).cell("A1").value("foo");

            // Get the output
            return workbook.outputAsync();
        })
        .then(data => {
            // Set the output file name.
            res.attachment("output.xlsx");

            // Send the workbook.
            res.send(data);
        })
        .catch(next);
});

Browser Usage

Usage in the browser is almost the same. A functional example can be found in examples/browser/index.html. The library is exposed globally as XlsxPopulate. Existing workbooks can be loaded from a file:

// Assuming there is a file input in the page with the id 'file-input'
var file = document.getElementById("file-input").files[0];

// A File object is a special kind of blob.
XlsxPopulate.fromDataAsync(file)
    .then(function (workbook) {
        // ...
    });

You can also load from AJAX if you set the responseType to 'arraybuffer':

var req = new XMLHttpRequest();
req.open("GET", "http://...", true);
req.responseType = "arraybuffer";
req.onreadystatechange = function () {
    if (req.readyState === 4 && req.status === 200){
        XlsxPopulate.fromDataAsync(req.response)
            .then(function (workbook) {
                // ...
            });
    }
};

req.send();

To download the workbook, you can either export as a blob (default behavior) or as a base64 string. You can then insert a link into the DOM and click it:

workbook.outputAsync()
    .then(function (blob) {
        if (window.navigator && window.navigator.msSaveOrOpenBlob) {
            // If IE, you must uses a different method.
            window.navigator.msSaveOrOpenBlob(blob, "out.xlsx");
        } else {
            var url = window.URL.createObjectURL(blob);
            var a = document.createElement("a");
            document.body.appendChild(a);
            a.href = url;
            a.download = "out.xlsx";
            a.click();
            window.URL.revokeObjectURL(url);
            document.body.removeChild(a);
        }
    });

Alternatively, you can download via a data URI, but this is not supported by IE:

workbook.outputAsync("base64")
    .then(function (base64) {
        location.href = "data:" + XlsxPopulate.MIME_TYPE + ";base64," + base64;
    });

Promises

xlsx-populate uses promises to manage async input/output. By default it uses the Promise defined in the browser or Node.js. In browsers that don't support promises (IE) a polyfill is used via JSZip.

// Get the current promise library in use.
// Helpful for getting a usable Promise library in IE.
var Promise = XlsxPopulate.Promise;

If you prefer, you can override the default Promise library used with another ES6 compliant library like bluebird.

const Promise = require("bluebird");
const XlsxPopulate = require("xlsx-populate");
XlsxPopulate.Promise = Promise;

Encryption

XLSX Agile encryption and descryption are supported so you can read and write password-protected workbooks. To read a protected workbook, pass the password in as an option:

XlsxPopulate.fromFileAsync("./Book1.xlsx", { password: "S3cret!" })
    .then(workbook => {
        // ...
    });

Similarly, to write a password encrypted workbook:

workbook.toFileAsync("./out.xlsx", { password: "S3cret!" });

The password option is supported in all output methods. N.B. Workbooks will only be encrypted if you supply a password when outputting even if they had a password when reading.

Encryption support is also available in the browser, but take care! Any password you put in browser code can be read by anyone with access to your code. You should only use passwords that are supplied by the end-user. Also, the performance of encryption/decryption in the browser is far worse than with Node.js. IE, in particular, is extremely slow. xlsx-populate is bundled for browsers with and without encryption support as the encryption libraries increase the size of the bundle a lot.

Missing Features

There are many, many features of the XLSX format that are not yet supported. If your use case needs something that isn't supported please open an issue to show your support. Better still, feel free to contribute a pull request!

Submitting an Issue

If you happen to run into a bug or an issue, please feel free to submit an issue. I only ask that you please include sample JavaScript code that demonstrates the issue. If the problem lies with modifying some template, it is incredibly difficult to debug the issue without the template. So please attach the template if possible. If you have confidentiality concerns, please attach a different workbook that exhibits the issue or you can send your workbook directly to dtjohnson after creating the issue.

Contributing

Pull requests are very much welcome! If you'd like to contribute, please make sure to read this section carefully first.

How xlsx-populate Works

An XLSX workbook is essentially a zip of a bunch of XML files. xlsx-populate uses JSZip to unzip the workbook and sax-js to parse the XML documents into corresponding objects. As you call methods, xlsx-populate manipulates the content of those objects. When you generate the output, xlsx-populate uses xmlbuilder-js to convert the objects back to XML and then uses JSZip to rezip them back into a workbook.

The way in which xlsx-populate manipulates objects that are essentially the XML data is very different from the usual way parser/generator libraries work. Most other libraries will deserialize the XML into a rich object model. That model is then manipulated and serialized back into XML upon generation. The challenge with this approach is that the Office Open XML spec is HUGE. It is extremely difficult for libraries to be able to support the entire specification. So these other libraries will deserialize only the portion of the spec they support and any other content/styles in the workbook they don't support are lost. Since xlsx-populate just manipulates the XML data, it is able to preserve styles and other content while still only supporting a fraction of the spec.

Setting up your Environment

You'll need to make sure Node.js v4+ is installed (as xlsx-populate uses ES6 syntax). You'll also need to install gulp:

npm install -g gulp

Make sure you have git installed. Then follow this guide to see how to check out code, branch, and then submit your code as a pull request. When you check out the code, you'll first need to install the npm dependencies. From the project root, run:

npm install

The default gulp task is set up to watch the source files for updates and retest while you edit. From the project root just run:

gulp

You should see the test output in your console window. As you edit files the tests will run again and show you if you've broken anything. (Note that if you've added new files you'll need to restart gulp for the new files to be watched.)

Now write your code and make sure to add Jasmine unit tests. When you are finished, you need to build the code for the browser. Do that by running the gulp build command:

gulp build

Verify all is working, check in your code, and submit a pull request.

Pull Request Checklist

To make sure your code is consistent and high quality, please make sure to follow this checklist before submitting a pull request:

Gulp Tasks

xlsx-populate uses gulp as a build tool. There are a number of tasks:

Style Reference

Styles

Style NameTypeDescription
boldbooleantrue for bold, false for not bold
italicbooleantrue for italic, false for not italic
underline<code>boolean|string</code>true for single underline, false for no underline, 'double' for double-underline
strikethroughbooleantrue for strikethrough false for not strikethrough
subscriptbooleantrue for subscript, false for not subscript (cannot be combined with superscript)
superscriptbooleantrue for superscript, false for not superscript (cannot be combined with subscript)
fontSizenumberFont size in points. Must be greater than 0.
fontFamilystringName of font family.
fontGenericFamilynumber1: Serif, 2: Sans Serif, 3: Monospace,
fontSchemestring'minor'|'major'|'none'
fontColor<code>Color|string|number</code>Color of the font. If string, will set an RGB color. If number, will set a theme color.
horizontalAlignmentstringHorizontal alignment. Allowed values: 'left', 'center', 'right', 'fill', 'justify', 'centerContinuous', 'distributed'
justifyLastLinebooleana.k.a Justified Distributed. Only applies when horizontalAlignment === 'distributed'. A boolean value indicating if the cells justified or distributed alignment should be used on the last line of text. (This is typical for East Asian alignments but not typical in other contexts.)
indentnumberNumber of indents. Must be greater than or equal to 0.
verticalAlignmentstringVertical alignment. Allowed values: 'top', 'center', 'bottom', 'justify', 'distributed'
wrapTextbooleantrue to wrap the text in the cell, false to not wrap.
shrinkToFitbooleantrue to shrink the text in the cell to fit, false to not shrink.
textDirectionstringDirection of the text. Allowed values: 'left-to-right', 'right-to-left'
textRotationnumberCounter-clockwise angle of rotation in degrees. Must be [-90, 90] where negative numbers indicate clockwise rotation.
angleTextCounterclockwisebooleanShortcut for textRotation of 45 degrees.
angleTextClockwisebooleanShortcut for textRotation of -45 degrees.
rotateTextUpbooleanShortcut for textRotation of 90 degrees.
rotateTextDownbooleanShortcut for textRotation of -90 degrees.
verticalTextbooleanSpecial rotation that shows text vertical but individual letters are oriented normally. true to rotate, false to not rotate.
fill<code>SolidFill|PatternFill|GradientFill|Color|string|number</code>The cell fill. If Color, will set a solid fill with the color. If string, will set a solid RGB fill. If number, will set a solid theme color fill.
border<code>Borders|Border|string|boolean</code>The border settings. If string, will set outside borders to given border style. If true, will set outside border style to 'thin'.
borderColor<code>Color|string|number</code>Color of the borders. If string, will set an RGB color. If number, will set a theme color.
borderStylestringStyle of the outside borders. Allowed values: 'hair', 'dotted', 'dashDotDot', 'dashed', 'mediumDashDotDot', 'thin', 'slantDashDot', 'mediumDashDot', 'mediumDashed', 'medium', 'thick', 'double'
leftBorder, rightBorder, topBorder, bottomBorder, diagonalBorder<code>Border|string|boolean</code>The border settings for the given side. If string, will set border to the given border style. If true, will set border style to 'thin'.
leftBorderColor, rightBorderColor, topBorderColor, bottomBorderColor, diagonalBorderColor<code>Color|string|number</code>Color of the given border. If string, will set an RGB color. If number, will set a theme color.
leftBorderStyle, rightBorderStyle, topBorderStyle, bottomBorderStyle, diagonalBorderStylestringStyle of the given side.
diagonalBorderDirectionstringDirection of the diagonal border(s) from left to right. Allowed values: 'up', 'down', 'both'
numberFormatstringNumber format code. See docs here.

Color

An object representing a color.

PropertyTypeDescription
[rgb]stringRGB color code (e.g. 'ff0000'). Either rgb or theme is required.
[theme]numberIndex of a theme color. Either rgb or theme is required.
[tint]numberOptional tint value of the color from -1 to 1. Particularly useful for theme colors. 0.0 means no tint, -1.0 means 100% darken, and 1.0 means 100% lighten.

Borders

An object representing all of the borders.

PropertyTypeDescription
[left]<code>Border|string|boolean</code>The border settings for the left side. If string, will set border to the given border style. If true, will set border style to 'thin'.
[right]<code>Border|string|boolean</code>The border settings for the right side. If string, will set border to the given border style. If true, will set border style to 'thin'.
[top]<code>Border|string|boolean</code>The border settings for the top side. If string, will set border to the given border style. If true, will set border style to 'thin'.
[bottom]<code>Border|string|boolean</code>The border settings for the bottom side. If string, will set border to the given border style. If true, will set border style to 'thin'.
[diagonal]<code>Border|string|boolean</code>The border settings for the diagonal side. If string, will set border to the given border style. If true, will set border style to 'thin'.

Border

An object representing an individual border.

PropertyTypeDescription
stylestringStyle of the given border.
color<code>Color|string|number</code>Color of the given border. If string, will set an RGB color. If number, will set a theme color.
[direction]stringFor diagonal border, the direction of the border(s) from left to right. Allowed values: 'up', 'down', 'both'

SolidFill

An object representing a solid fill.

PropertyTypeDescription
type'solid'
color<code>Color|string|number</code>Color of the fill. If string, will set an RGB color. If number, will set a theme color.

PatternFill

An object representing a pattern fill.

PropertyTypeDescription
type'pattern'
patternstringName of the pattern. Allowed values: 'gray125', 'darkGray', 'mediumGray', 'lightGray', 'gray0625', 'darkHorizontal', 'darkVertical', 'darkDown', 'darkUp', 'darkGrid', 'darkTrellis', 'lightHorizontal', 'lightVertical', 'lightDown', 'lightUp', 'lightGrid', 'lightTrellis'.
foreground<code>Color|string|number</code>Color of the foreground. If string, will set an RGB color. If number, will set a theme color.
background<code>Color|string|number</code>Color of the background. If string, will set an RGB color. If number, will set a theme color.

GradientFill

An object representing a gradient fill.

PropertyTypeDescription
type'gradient'
[gradientType]stringType of gradient. Allowed values: 'linear' (default), 'path'. With a path gradient, a path is drawn between the top, left, right, and bottom values and a graident is draw from that path to the outside of the cell.
stopsArray.<{}>
stops[].positionnumberThe position of the stop from 0 to 1.
stops[].color<code>Color|string|number</code>Color of the stop. If string, will set an RGB color. If number, will set a theme color.
[angle]numberIf linear gradient, the angle of clockwise rotation of the gradient.
[left]numberIf path gradient, the left position of the path as a percentage from 0 to 1.
[right]numberIf path gradient, the right position of the path as a percentage from 0 to 1.
[top]numberIf path gradient, the top position of the path as a percentage from 0 to 1.
[bottom]numberIf path gradient, the bottom position of the path as a percentage from 0 to 1.

API Reference

Classes

<dl> <dt><a href="#Cell">Cell</a></dt> <dd><p>A cell</p> </dd> <dt><a href="#Column">Column</a></dt> <dd><p>A column.</p> </dd> <dt><a href="#FormulaError">FormulaError</a></dt> <dd><p>A formula error (e.g. #DIV/0!).</p> </dd> <dt><a href="#PageBreaks">PageBreaks</a></dt> <dd><p>PageBreaks</p> </dd> <dt><a href="#Range">Range</a></dt> <dd><p>A range of cells.</p> </dd> <dt><a href="#RichText">RichText</a></dt> <dd><p>A RichText class that contains many <a href="#RichTextFragment">RichTextFragment</a>.</p> </dd> <dt><a href="#RichTextFragment">RichTextFragment</a></dt> <dd><p>A Rich text fragment.</p> </dd> <dt><a href="#Row">Row</a></dt> <dd><p>A row.</p> </dd> <dt><a href="#Sheet">Sheet</a></dt> <dd><p>A worksheet.</p> </dd> <dt><a href="#Workbook">Workbook</a></dt> <dd><p>A workbook.</p> </dd> </dl>

Objects

<dl> <dt><a href="#XlsxPopulate">XlsxPopulate</a> : <code>object</code></dt> <dd></dd> </dl>

Constants

<dl> <dt><a href="#_">_</a></dt> <dd><p>OOXML uses the CFB file format with Agile Encryption. The details of the encryption are here: <a href="https://msdn.microsoft.com/en-us/library/dd950165(v=office.12).aspx">https://msdn.microsoft.com/en-us/library/dd950165(v=office.12).aspx</a></p> <p>Helpful guidance also take from this Github project: <a href="https://github.com/nolze/ms-offcrypto-tool">https://github.com/nolze/ms-offcrypto-tool</a></p> </dd> </dl>

Typedefs

<dl> <dt><a href="#PaneOptions">PaneOptions</a> : <code>Object</code></dt> <dd><p><a href="https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.pane?view=openxml-2.8.1">https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.pane?view=openxml-2.8.1</a></p> </dd> </dl>

<a name="Cell"></a>

Cell

A cell

Kind: global class

<a name="Cell+active"></a>

cell.active() ⇒ <code>boolean</code>

Gets a value indicating whether the cell is the active cell in the sheet.

Kind: instance method of <code>Cell</code>
Returns: <code>boolean</code> - True if active, false otherwise.
<a name="Cell+active"></a>

cell.active(active) ⇒ <code>Cell</code>

Make the cell the active cell in the sheet.

Kind: instance method of <code>Cell</code>
Returns: <code>Cell</code> - The cell.

ParamTypeDescription
active<code>boolean</code>Must be set to true. Deactivating directly is not supported. To deactivate, you should activate a different cell instead.

<a name="Cell+address"></a>

cell.address([opts]) ⇒ <code>string</code>

Get the address of the column.

Kind: instance method of <code>Cell</code>
Returns: <code>string</code> - The address

ParamTypeDescription
[opts]<code>Object</code>Options
[opts.includeSheetName]<code>boolean</code>Include the sheet name in the address.
[opts.rowAnchored]<code>boolean</code>Anchor the row.
[opts.columnAnchored]<code>boolean</code>Anchor the column.
[opts.anchored]<code>boolean</code>Anchor both the row and the column.

<a name="Cell+column"></a>

cell.column() ⇒ <code>Column</code>

Gets the parent column of the cell.

Kind: instance method of <code>Cell</code>
Returns: <code>Column</code> - The parent column.
<a name="Cell+clear"></a>

cell.clear() ⇒ <code>Cell</code>

Clears the contents from the cell.

Kind: instance method of <code>Cell</code>
Returns: <code>Cell</code> - The cell.
<a name="Cell+columnName"></a>

cell.columnName() ⇒ <code>string</code>

Gets the column name of the cell.

Kind: instance method of <code>Cell</code>
Returns: <code>string</code> - The column name.
<a name="Cell+columnNumber"></a>

cell.columnNumber() ⇒ <code>number</code>

Gets the column number of the cell (1-based).

Kind: instance method of <code>Cell</code>
Returns: <code>number</code> - The column number.
<a name="Cell+find"></a>

cell.find(pattern, [replacement]) ⇒ <code>boolean</code>

Find the given pattern in the cell and optionally replace it.

Kind: instance method of <code>Cell</code>
Returns: <code>boolean</code> - A flag indicating if the pattern was found.

ParamTypeDescription
pattern<code>string</code> | <code>RegExp</code>The pattern to look for. Providing a string will result in a case-insensitive substring search. Use a RegExp for more sophisticated searches.
[replacement]<code>string</code> | <code>function</code>The text to replace or a String.replace callback function. If pattern is a string, all occurrences of the pattern in the cell will be replaced.

<a name="Cell+formula"></a>

cell.formula() ⇒ <code>string</code>

Gets the formula in the cell. Note that if a formula was set as part of a range, the getter will return 'SHARED'. This is a limitation that may be addressed in a future release.

Kind: instance method of <code>Cell</code>
Returns: <code>string</code> - The formula in the cell.
<a name="Cell+formula"></a>

cell.formula(formula) ⇒ <code>Cell</code>

Sets the formula in the cell.

Kind: instance method of <code>Cell</code>
Returns: <code>Cell</code> - The cell.

ParamTypeDescription
formula<code>string</code>The formula to set.

<a name="Cell+hyperlink"></a>

cell.hyperlink() ⇒ <code>string</code> | <code>undefined</code>

Gets the hyperlink attached to the cell.

Kind: instance method of <code>Cell</code>
Returns: <code>string</code> | <code>undefined</code> - The hyperlink or undefined if not set.
<a name="Cell+hyperlink"></a>

cell.hyperlink(hyperlink) ⇒ <code>Cell</code>

Set or clear the hyperlink on the cell.

Kind: instance method of <code>Cell</code>
Returns: <code>Cell</code> - The cell.

ParamTypeDescription
hyperlink<code>string</code> | <code>Cell</code> | <code>undefined</code>The hyperlink to set or undefined to clear.

<a name="Cell+hyperlink"></a>

cell.hyperlink(opts) ⇒ <code>Cell</code>

Set the hyperlink options on the cell.

Kind: instance method of <code>Cell</code>
Returns: <code>Cell</code> - The cell.

ParamTypeDescription
opts<code>Object</code> | <code>Cell</code>Options or Cell. If opts is a Cell then an internal hyperlink is added.
[opts.hyperlink]<code>string</code> | <code>Cell</code>The hyperlink to set, can be a Cell or an internal/external string.
[opts.tooltip]<code>string</code>Additional text to help the user understand more about the hyperlink.
[opts.email]<code>string</code>Email address, ignored if opts.hyperlink is set.
[opts.emailSubject]<code>string</code>Email subject, ignored if opts.hyperlink is set.

<a name="Cell+dataValidation"></a>

cell.dataValidation() ⇒ <code>object</code> | <code>undefined</code>

Gets the data validation object attached to the cell.

Kind: instance method of <code>Cell</code>
Returns: <code>object</code> | <code>undefined</code> - The data validation or undefined if not set.
<a name="Cell+dataValidation"></a>

cell.dataValidation(dataValidation) ⇒ <code>Cell</code>

Set or clear the data validation object of the cell.

Kind: instance method of <code>Cell</code>
Returns: <code>Cell</code> - The cell.

ParamTypeDescription
dataValidation<code>object</code> | <code>undefined</code>Object or null to clear.

<a name="Cell+tap"></a>

cell.tap(callback) ⇒ <code>Cell</code>

Invoke a callback on the cell and return the cell. Useful for method chaining.

Kind: instance method of <code>Cell</code>
Returns: <code>Cell</code> - The cell.

ParamTypeDescription
callback<code>tapCallback</code>The callback function.

<a name="Cell+thru"></a>

cell.thru(callback) ⇒ <code>*</code>

Invoke a callback on the cell and return the value provided by the callback. Useful for method chaining.

Kind: instance method of <code>Cell</code>
Returns: <code>*</code> - The return value of the callback.

ParamTypeDescription
callback<code>thruCallback</code>The callback function.

<a name="Cell+rangeTo"></a>

cell.rangeTo(cell) ⇒ <code>Range</code>

Create a range from this cell and another.

Kind: instance method of <code>Cell</code>
Returns: <code>Range</code> - The range.

ParamTypeDescription
cell<code>Cell</code> | <code>string</code>The other cell or cell address to range to.

<a name="Cell+relativeCell"></a>

cell.relativeCell(rowOffset, columnOffset) ⇒ <code>Cell</code>

Returns a cell with a relative position given the offsets provided.

Kind: instance method of <code>Cell</code>
Returns: <code>Cell</code> - The relative cell.

ParamTypeDescription
rowOffset<code>number</code>The row offset (0 for the current row).
columnOffset<code>number</code>The column offset (0 for the current column).

<a name="Cell+row"></a>

cell.row() ⇒ <code>Row</code>

Gets the parent row of the cell.

Kind: instance method of <code>Cell</code>
Returns: <code>Row</code> - The parent row.
<a name="Cell+rowNumber"></a>

cell.rowNumber() ⇒ <code>number</code>

Gets the row number of the cell (1-based).

Kind: instance method of <code>Cell</code>
Returns: <code>number</code> - The row number.
<a name="Cell+sheet"></a>

cell.sheet() ⇒ <code>Sheet</code>

Gets the parent sheet.

Kind: instance method of <code>Cell</code>
Returns: <code>Sheet</code> - The parent sheet.
<a name="Cell+style"></a>

cell.style(name) ⇒ <code>*</code>

Gets an individual style.

Kind: instance method of <code>Cell</code>
Returns: <code>*</code> - The style.

ParamTypeDescription
name<code>string</code>The name of the style.

<a name="Cell+style"></a>

cell.style(names) ⇒ <code>object.<string, *></code>

Gets multiple styles.

Kind: instance method of <code>Cell</code>
Returns: <code>object.<string, *></code> - Object whose keys are the style names and values are the styles.

ParamTypeDescription
names<code>Array.<string></code>The names of the style.

<a name="Cell+style"></a>

cell.style(name, value) ⇒ <code>Cell</code>

Sets an individual style.

Kind: instance method of <code>Cell</code>
Returns: <code>Cell</code> - The cell.

ParamTypeDescription
name<code>string</code>The name of the style.
value<code>*</code>The value to set.

<a name="Cell+style"></a>

cell.style(name) ⇒ <code>Range</code>

Sets the styles in the range starting with the cell.

Kind: instance method of <code>Cell</code>
Returns: <code>Range</code> - The range that was set.

ParamTypeDescription
name<code>string</code>The name of the style.
<code>Array.<Array.<*>></code>2D array of values to set.

<a name="Cell+style"></a>

cell.style(styles) ⇒ <code>Cell</code>

Sets multiple styles.

Kind: instance method of <code>Cell</code>
Returns: <code>Cell</code> - The cell.

ParamTypeDescription
styles<code>object.<string, *></code>Object whose keys are the style names and values are the styles to set.

<a name="Cell+style"></a>

cell.style(style) ⇒ <code>Cell</code>

Sets to a specific style

Kind: instance method of <code>Cell</code>
Returns: <code>Cell</code> - The cell.

ParamTypeDescription
style<code>Style</code>Style object given from stylesheet.createStyle

<a name="Cell+value"></a>

cell.value() ⇒ <code>string</code> | <code>boolean</code> | <code>number</code> | <code>Date</code> | <code>RichText</code> | <code>undefined</code>

Gets the value of the cell.

Kind: instance method of <code>Cell</code>
Returns: <code>string</code> | <code>boolean</code> | <code>number</code> | <code>Date</code> | <code>RichText</code> | <code>undefined</code> - The value of the cell.
<a name="Cell+value"></a>

cell.value(value) ⇒ <code>Cell</code>

Sets the value of the cell.

Kind: instance method of <code>Cell</code>
Returns: <code>Cell</code> - The cell.

ParamTypeDescription
value<code>string</code> | <code>boolean</code> | <code>number</code> | <code>null</code> | <code>undefined</code> | <code>RichText</code>The value to set.

<a name="Cell+value"></a>

cell.value() ⇒ <code>Range</code>

Sets the values in the range starting with the cell.

Kind: instance method of <code>Cell</code>
Returns: <code>Range</code> - The range that was set.

ParamTypeDescription
<code>Array.<Array.<(string|boolean|number|null|undefined)>></code>2D array of values to set.

<a name="Cell+workbook"></a>

cell.workbook() ⇒ <code>Workbook</code>

Gets the parent workbook.

Kind: instance method of <code>Cell</code>
Returns: <code>Workbook</code> - The parent workbook.
<a name="Cell+addHorizontalPageBreak"></a>

cell.addHorizontalPageBreak() ⇒ <code>Cell</code>

Append horizontal page break after the cell.

Kind: instance method of <code>Cell</code>
Returns: <code>Cell</code> - the cell.
<a name="Cell..tapCallback"></a>

Cell~tapCallback ⇒ <code>undefined</code>

Callback used by tap.

Kind: inner typedef of <code>Cell</code>

ParamTypeDescription
cell<code>Cell</code>The cell

<a name="Cell..thruCallback"></a>

Cell~thruCallback ⇒ <code>*</code>

Callback used by thru.

Kind: inner typedef of <code>Cell</code>
Returns: <code>*</code> - The value to return from thru.

ParamTypeDescription
cell<code>Cell</code>The cell

<a name="Column"></a>

Column

A column.

Kind: global class

<a name="Column+address"></a>

column.address([opts]) ⇒ <code>string</code>

Get the address of the column.

Kind: instance method of <code>Column</code>
Returns: <code>string</code> - The address

ParamTypeDescription
[opts]<code>Object</code>Options
[opts.includeSheetName]<code>boolean</code>Include the sheet name in the address.
[opts.anchored]<code>boolean</code>Anchor the address.

<a name="Column+cell"></a>

column.cell(rowNumber) ⇒ <code>Cell</code>

Get a cell within the column.

Kind: instance method of <code>Column</code>
Returns: <code>Cell</code> - The cell in the column with the given row number.

ParamTypeDescription
rowNumber<code>number</code>The row number.

<a name="Column+columnName"></a>

column.columnName() ⇒ <code>string</code>

Get the name of the column.

Kind: instance method of <code>Column</code>
Returns: <code>string</code> - The column name.
<a name="Column+columnNumber"></a>

column.columnNumber() ⇒ <code>number</code>

Get the number of the column.

Kind: instance method of <code>Column</code>
Returns: <code>number</code> - The column number.
<a name="Column+hidden"></a>

column.hidden() ⇒ <code>boolean</code>

Gets a value indicating whether the column is hidden.

Kind: instance method of <code>Column</code>
Returns: <code>boolean</code> - A flag indicating whether the column is hidden.
<a name="Column+hidden"></a>

column.hidden(hidden) ⇒ <code>Column</code>

Sets whether the column is hidden.

Kind: instance method of <code>Column</code>
Returns: <code>Column</code> - The column.

ParamTypeDescription
hidden<code>boolean</code>A flag indicating whether to hide the column.

<a name="Column+sheet"></a>

column.sheet() ⇒ <code>Sheet</code>

Get the parent sheet.

Kind: instance method of <code>Column</code>
Returns: <code>Sheet</code> - The parent sheet.
<a name="Column+style"></a>

column.style(name) ⇒ <code>*</code>

Gets an individual style.

Kind: instance method of <code>Column</code>
Returns: <code>*</code> - The style.

ParamTypeDescription
name<code>string</code>The name of the style.

<a name="Column+style"></a>

column.style(names) ⇒ <code>object.<string, *></code>

Gets multiple styles.

Kind: instance method of <code>Column</code>
Returns: <code>object.<string, *></code> - Object whose keys are the style names and values are the styles.

ParamTypeDescription
names<code>Array.<string></code>The names of the style.

<a name="Column+style"></a>

column.style(name, value) ⇒ <code>Cell</code>

Sets an individual style.

Kind: instance method of <code>Column</code>
Returns: <code>Cell</code> - The cell.

ParamTypeDescription
name<code>string</code>The name of the style.
value<code>*</code>The value to set.

<a name="Column+style"></a>

column.style(styles) ⇒ <code>Cell</code>

Sets multiple styles.

Kind: instance method of <code>Column</code>
Returns: <code>Cell</code> - The cell.

ParamTypeDescription
styles<code>object.<string, *></code>Object whose keys are the style names and values are the styles to set.

<a name="Column+style"></a>

column.style(style) ⇒ <code>Cell</code>

Sets to a specific style

Kind: instance method of <code>Column</code>
Returns: <code>Cell</code> - The cell.

ParamTypeDescription
style<code>Style</code>Style object given from stylesheet.createStyle

<a name="Column+width"></a>

column.width() ⇒ <code>undefined</code> | <code>number</code>

Gets the width.

Kind: instance method of <code>Column</code>
Returns: <code>undefined</code> | <code>number</code> - The width (or undefined).
<a name="Column+width"></a>

column.width(width) ⇒ <code>Column</code>

Sets the width.

Kind: instance method of <code>Column</code>
Returns: <code>Column</code> - The column.

ParamTypeDescription
width<code>number</code>The width of the column.

<a name="Column+workbook"></a>

column.workbook() ⇒ <code>Workbook</code>

Get the parent workbook.

Kind: instance method of <code>Column</code>
Returns: <code>Workbook</code> - The parent workbook.
<a name="Column+addPageBreak"></a>

column.addPageBreak() ⇒ <code>Column</code>

Append vertical page break after the column.

Kind: instance method of <code>Column</code>
Returns: <code>Column</code> - the column.
<a name="FormulaError"></a>

FormulaError

A formula error (e.g. #DIV/0!).

Kind: global class

<a name="FormulaError+error"></a>

formulaError.error() ⇒ <code>string</code>

Get the error code.

Kind: instance method of <code>FormulaError</code>
Returns: <code>string</code> - The error code.
<a name="FormulaError.DIV0"></a>

FormulaError.DIV0 : <code>FormulaError</code>

#DIV/0! error.

Kind: static property of <code>FormulaError</code>
<a name="FormulaError.NA"></a>

FormulaError.NA : <code>FormulaError</code>

#N/A error.

Kind: static property of <code>FormulaError</code>
<a name="FormulaError.NAME"></a>

FormulaError.NAME : <code>FormulaError</code>

#NAME? error.

Kind: static property of <code>FormulaError</code>
<a name="FormulaError.NULL"></a>

FormulaError.NULL : <code>FormulaError</code>

#NULL! error.

Kind: static property of <code>FormulaError</code>
<a name="FormulaError.NUM"></a>

FormulaError.NUM : <code>FormulaError</code>

#NUM! error.

Kind: static property of <code>FormulaError</code>
<a name="FormulaError.REF"></a>

FormulaError.REF : <code>FormulaError</code>

#REF! error.

Kind: static property of <code>FormulaError</code>
<a name="FormulaError.VALUE"></a>

FormulaError.VALUE : <code>FormulaError</code>

#VALUE! error.

Kind: static property of <code>FormulaError</code>
<a name="PageBreaks"></a>

PageBreaks

PageBreaks

Kind: global class

<a name="PageBreaks+count"></a>

pageBreaks.count ⇒ <code>number</code>

get count of the page-breaks

Kind: instance property of <code>PageBreaks</code>
Returns: <code>number</code> - the page-breaks' count
<a name="PageBreaks+list"></a>

pageBreaks.list ⇒ <code>Array</code>

get list of page-breaks

Kind: instance property of <code>PageBreaks</code>
Returns: <code>Array</code> - list of the page-breaks
<a name="PageBreaks+add"></a>

pageBreaks.add(id) ⇒ <code>PageBreaks</code>

add page-breaks by row/column id

Kind: instance method of <code>PageBreaks</code>
Returns: <code>PageBreaks</code> - the page-breaks

ParamTypeDescription
id<code>number</code>row/column id (rowNumber/colNumber)

<a name="PageBreaks+remove"></a>

pageBreaks.remove(index) ⇒ <code>PageBreaks</code>

remove page-breaks by index

Kind: instance method of <code>PageBreaks</code>
Returns: <code>PageBreaks</code> - the page-breaks

ParamTypeDescription
index<code>number</code>index of list

<a name="Range"></a>

Range

A range of cells.

Kind: global class

<a name="Range+address"></a>

range.address([opts]) ⇒ <code>string</code>

Get the address of the range.

Kind: instance method of <code>Range</code>
Returns: <code>string</code> - The address.

ParamTypeDescription
[opts]<code>Object</code>Options
[opts.includeSheetName]<code>boolean</code>Include the sheet name in the address.
[opts.startRowAnchored]<code>boolean</code>Anchor the start row.
[opts.startColumnAnchored]<code>boolean</code>Anchor the start column.
[opts.endRowAnchored]<code>boolean</code>Anchor the end row.
[opts.endColumnAnchored]<code>boolean</code>Anchor the end column.
[opts.anchored]<code>boolean</code>Anchor all row and columns.

<a name="Range+cell"></a>

range.cell(ri, ci) ⇒ <code>Cell</code>

Gets a cell within the range.

Kind: instance method of <code>Range</code>
Returns: <code>Cell</code> - The cell.

ParamTypeDescription
ri<code>number</code>Row index relative to the top-left corner of the range (0-based).
ci<code>number</code>Column index relative to the top-left corner of the range (0-based).

<a name="Range+autoFilter"></a>

range.autoFilter() ⇒ <code>Range</code>

Sets sheet autoFilter to this range.

Kind: instance method of <code>Range</code>
Returns: <code>Range</code> - This range.
<a name="Range+cells"></a>

range.cells() ⇒ <code>Array.<Array.<Cell>></code>

Get the cells in the range as a 2D array.

Kind: instance method of <code>Range</code>
Returns: <code>Array.<Array.<Cell>></code> - The cells.
<a name="Range+clear"></a>

range.clear() ⇒ <code>Range</code>

Clear the contents of all the cells in the range.

Kind: instance method of <code>Range</code>
Returns: <code>Range</code> - The range.
<a name="Range+endCell"></a>

range.endCell() ⇒ <code>Cell</code>

Get the end cell of the range.

Kind: instance method of <code>Range</code>
Returns: <code>Cell</code> - The end cell.
<a name="Range+forEach"></a>

range.forEach(callback) ⇒ <code>Range</code>

Call a function for each cell in the range. Goes by row then column.

Kind: instance method of <code>Range</code>
Returns: <code>Range</code> - The range.

ParamTypeDescription
callback<code>forEachCallback</code>Function called for each cell in the range.

<a name="Range+formula"></a>

range.formula() ⇒ <code>string</code> | <code>undefined</code>

Gets the shared formula in the start cell (assuming it's the source of the shared formula).

Kind: instance method of <code>Range</code>
Returns: <code>string</code> | <code>undefined</code> - The shared formula.
<a name="Range+formula"></a>

range.formula(formula) ⇒ <code>Range</code>

Sets the shared formula in the range. The formula will be translated for each cell.

Kind: instance method of <code>Range</code>
Returns: <code>Range</code> - The range.

ParamTypeDescription
formula<code>string</code>The formula to set.

<a name="Range+map"></a>

range.map(callback) ⇒ <code>Array.<Array.<*>></code>

Creates a 2D array of values by running each cell through a callback.

Kind: instance method of <code>Range</code>
Returns: <code>Array.<Array.<*>></code> - The 2D array of return values.

ParamTypeDescription
callback<code>mapCallback</code>Function called for each cell in the range.

<a name="Range+merged"></a>

range.merged() ⇒ <code>boolean</code>

Gets a value indicating whether the cells in the range are merged.

Kind: instance method of <code>Range</code>
Returns: <code>boolean</code> - The value.
<a name="Range+merged"></a>

range.merged(merged) ⇒ <code>Range</code>

Sets a value indicating whether the cells in the range should be merged.

Kind: instance method of <code>Range</code>
Returns: <code>Range</code> - The range.

ParamTypeDescription
merged<code>boolean</code>True to merge, false to unmerge.

<a name="Range+dataValidation"></a>

range.dataValidation() ⇒ <code>object</code> | <code>undefined</code>

Gets the data validation object attached to the Range.

Kind: instance method of <code>Range</code>
Returns: <code>object</code> | <code>undefined</code> - The data validation object or undefined if not set.
<a name="Range+dataValidation"></a>

range.dataValidation(dataValidation) ⇒ <code>Range</code>

Set or clear the data validation object of the entire range.

Kind: instance method of <code>Range</code>
Returns: <code>Range</code> - The range.

ParamTypeDescription
dataValidation<code>object</code> | <code>undefined</code>Object or null to clear.

<a name="Range+reduce"></a>

range.reduce(callback, [initialValue]) ⇒ <code>*</code>

Reduces the range to a single value accumulated from the result of a function called for each cell.

Kind: instance method of <code>Range</code>
Returns: <code>*</code> - The accumulated value.

ParamTypeDescription
callback<code>reduceCallback</code>Function called for each cell in the range.
[initialValue]<code>*</code>The initial value.

<a name="Range+sheet"></a>

range.sheet() ⇒ <code>Sheet</code>

Gets the parent sheet of the range.

Kind: instance method of <code>Range</code>
Returns: <code>Sheet</code> - The parent sheet.
<a name="Range+startCell"></a>

range.startCell() ⇒ <code>Cell</code>

Gets the start cell of the range.

Kind: instance method of <code>Range</code>
Returns: <code>Cell</code> - The start cell.
<a name="Range+style"></a>

range.style(name) ⇒ <code>Array.<Array.<*>></code>

Gets a single style for each cell.

Kind: instance method of <code>Range</code>
Returns: <code>Array.<Array.<*>></code> - 2D array of style values.

ParamTypeDescription
name<code>string</code>The name of the style.

<a name="Range+style"></a>

range.style(names) ⇒ <code>Object.<string, Array.<Array.<*>>></code>

Gets multiple styles for each cell.

Kind: instance method of <code>Range</code>
Returns: <code>Object.<string, Array.<Array.<*>>></code> - Object whose keys are style names and values are 2D arrays of style values.

ParamTypeDescription
names<code>Array.<string></code>The names of the styles.

<a name="Range+style"></a>

range.style(name, callback) ⇒ <code>Range</code>

Set the style in each cell to the result of a function called for each.

Kind: instance method of <code>Range</code>
Returns: <code>Range</code> - The range.

ParamTypeDescription
name<code>string</code>The name of the style.
callback<code>mapCallback</code>The callback to provide value for the cell.

<a name="Range+style"></a>

range.style(name, values) ⇒ <code>Range</code>

Sets the style in each cell to the corresponding value in the given 2D array of values.

Kind: instance method of <code>Range</code>
Returns: <code>Range</code> - The range.

ParamTypeDescription
name<code>string</code>The name of the style.
values<code>Array.<Array.<*>></code>The style values to set.

<a name="Range+style"></a>

range.style(name, value) ⇒ <code>Range</code>

Set the style of all cells in the range to a single style value.

Kind: instance method of <code>Range</code>
Returns: <code>Range</code> - The range.

ParamTypeDescription
name<code>string</code>The name of the style.
value<code>*</code>The value to set.

<a name="Range+style"></a>

range.style(styles) ⇒ <code>Range</code>

Set multiple styles for the cells in the range.

Kind: instance method of <code>Range</code>
Returns: <code>Range</code> - The range.

ParamTypeDescription
styles<code>object.<string, (Range~mapCallback|Array.<Array.<*>>|*)></code>Object whose keys are style names and values are either function callbacks, 2D arrays of style values, or a single value for all the cells.

<a name="Range+style"></a>

range.style(style) ⇒ <code>Range</code>

Sets to a specific style

Kind: instance method of <code>Range</code>
Returns: <code>Range</code> - The range.

ParamTypeDescription
style<code>Style</code>Style object given from stylesheet.createStyle

<a name="Range+tap"></a>

range.tap(callback) ⇒ <code>Range</code>

Invoke a callback on the range and return the range. Useful for method chaining.

Kind: instance method of <code>Range</code>
Returns: <code>Range</code> - The range.

ParamTypeDescription
callback<code>tapCallback</code>The callback function.

<a name="Range+thru"></a>

range.thru(callback) ⇒ <code>*</code>

Invoke a callback on the range and return the value provided by the callback. Useful for method chaining.

Kind: instance method of <code>Range</code>
Returns: <code>*</code> - The return value of the callback.

ParamTypeDescription
callback<code>thruCallback</code>The callback function.

<a name="Range+value"></a>

range.value() ⇒ <code>Array.<Array.<*>></code>

Get the values of each cell in the range as a 2D array.

Kind: instance method of <code>Range</code>
Returns: <code>Array.<Array.<*>></code> - The values.
<a name="Range+value"></a>

range.value(callback) ⇒ <code>Range</code>

Set the values in each cell to the result of a function called for each.

Kind: instance method of <code>Range</code>
Returns: <code>Range</code> - The range.

ParamTypeDescription
callback<code>mapCallback</code>The callback to provide value for the cell.

<a name="Range+value"></a>

range.value(values) ⇒ <code>Range</code>

Sets the value in each cell to the corresponding value in the given 2D array of values.

Kind: instance method of <code>Range</code>
Returns: <code>Range</code> - The range.

ParamTypeDescription
values<code>Array.<Array.<*>></code>The values to set.

<a name="Range+value"></a>

range.value(value) ⇒ <code>Range</code>

Set the value of all cells in the range to a single value.

Kind: instance method of <code>Range</code>
Returns: <code>Range</code> - The range.

ParamTypeDescription
value<code>*</code>The value to set.

<a name="Range+workbook"></a>

range.workbook() ⇒ <code>Workbook</code>

Gets the parent workbook.

Kind: instance method of <code>Range</code>
Returns: <code>Workbook</code> - The parent workbook.
<a name="Range..forEachCallback"></a>

Range~forEachCallback ⇒ <code>undefined</code>

Callback used by forEach.

Kind: inner typedef of <code>Range</code>

ParamTypeDescription
cell<code>Cell</code>The cell.
ri<code>number</code>The relative row index.
ci<code>number</code>The relative column index.
range<code>Range</code>The range.

<a name="Range..mapCallback"></a>

Range~mapCallback ⇒ <code>*</code>

Callback used by map.

Kind: inner typedef of <code>Range</code>
Returns: <code>*</code> - The value to map to.

ParamTypeDescription
cell<code>Cell</code>The cell.
ri<code>number</code>The relative row index.
ci<code>number</code>The relative column index.
range<code>Range</code>The range.

<a name="Range..reduceCallback"></a>

Range~reduceCallback ⇒ <code>*</code>

Callback used by reduce.

Kind: inner typedef of <code>Range</code>
Returns: <code>*</code> - The value to map to.

ParamTypeDescription
accumulator<code>*</code>The accumulated value.
cell<code>Cell</code>The cell.
ri<code>number</code>The relative row index.
ci<code>number</code>The relative column index.
range<code>Range</code>The range.

<a name="Range..tapCallback"></a>

Range~tapCallback ⇒ <code>undefined</code>

Callback used by tap.

Kind: inner typedef of <code>Range</code>

ParamTypeDescription
range<code>Range</code>The range.

<a name="Range..thruCallback"></a>

Range~thruCallback ⇒ <code>*</code>

Callback used by thru.

Kind: inner typedef of <code>Range</code>
Returns: <code>*</code> - The value to return from thru.

ParamTypeDescription
range<code>Range</code>The range.

<a name="RichText"></a>

RichText

A RichText class that contains many RichTextFragment.

Kind: global class

<a name="new_RichText_new"></a>

new RichText([node])

Creates a new instance of RichText. If you get the instance by calling Cell.value(), adding a text contains line separator will trigger Cell.style('wrapText', true), which will make MS Excel show the new line. i.e. In MS Excel, Tap "alt+Enter" in a cell, the cell will set wrap text to true automatically.

ParamTypeDescription
[node]<code>undefined</code> | <code>null</code> | <code>Object</code>The node stored in the shared string

<a name="RichText+cell"></a>

richText.cell ⇒ <code>Cell</code> | <code>undefined</code>

Gets which cell this RichText instance belongs to.

Kind: instance property of <code>RichText</code>
Returns: <code>Cell</code> | <code>undefined</code> - The cell this instance belongs to.
<a name="RichText+length"></a>

richText.length ⇒ <code>number</code>

Gets the how many rich text fragment this RichText instance contains

Kind: instance property of <code>RichText</code>
Returns: <code>number</code> - The number of fragments this RichText instance has.
<a name="RichText+text"></a>

richText.text() ⇒ <code>string</code>

Gets concatenated text without styles.

Kind: instance method of <code>RichText</code>
Returns: <code>string</code> - concatenated text
<a name="RichText+getInstanceWithCellRef"></a>

richText.getInstanceWithCellRef(cell) ⇒ <code>RichText</code>

Gets the instance with cell reference defined.

Kind: instance method of <code>RichText</code>
Returns: <code>RichText</code> - The instance with cell reference defined.

ParamTypeDescription
cell<code>Cell</code>Cell reference.

<a name="RichText+copy"></a>

richText.copy([cell]) ⇒ <code>RichText</code>

Returns a deep copy of this instance. If cell reference is provided, it checks line separators and calls cell.style('wrapText', true) when needed.

Kind: instance method of <code>RichText</code>
Returns: <code>RichText</code> - A deep copied instance

ParamTypeDescription
[cell]<code>Cell</code> | <code>undefined</code>The cell reference.

<a name="RichText+get"></a>

richText.get(index) ⇒ <code>RichTextFragment</code>

Gets the ith fragment of this RichText instance.

Kind: instance method of <code>RichText</code>
Returns: <code>RichTextFragment</code> - A rich text fragment

ParamTypeDescription
index<code>number</code>The index

<a name="RichText+remove"></a>

richText.remove(index) ⇒ <code>RichText</code>

Removes a rich text fragment. This instance will be mutated.

Kind: instance method of <code>RichText</code>
Returns: <code>RichText</code> - the rich text instance

ParamTypeDescription
index<code>number</code>the index of the fragment to remove

<a name="RichText+add"></a>

richText.add(text, [styles], [index]) ⇒ <code>RichText</code>

Adds a rich text fragment to the last or after the given index. This instance will be mutated.

Kind: instance method of <code>RichText</code>
Returns: <code>RichText</code> - the rich text instance

ParamTypeDescription
text<code>string</code>the text
[styles]<code>Object</code>the styles js object, i.e. {fontSize: 12}
[index]<code>number</code> | <code>undefined</code> | <code>null</code>the index of the fragment to add

<a name="RichText+clear"></a>

richText.clear() ⇒ <code>RichText</code>

Clears this rich text

Kind: instance method of <code>RichText</code>
Returns: <code>RichText</code> - the rich text instance
<a name="RichText+removeUnsupportedNodes"></a>

richText.removeUnsupportedNodes() ⇒ <code>undefined</code>

Remove all unsupported nodes (phoneticPr, rPh for Japanese language).

Kind: instance method of <code>RichText</code>
<a name="RichTextFragment"></a>

RichTextFragment

A Rich text fragment.

Kind: global class

<a name="new_RichTextFragment_new"></a>

new RichTextFragment(value, [styles], richText)

Creates a new instance of RichTextFragment.

ParamTypeDescription
value<code>string</code> | <code>Object</code>Text value or XML node
[styles]<code>object</code> | <code>undefined</code> | <code>null</code>Multiple styles.
richText<code>RichText</code>The rich text instance where this fragment belongs to.

<a name="RichTextFragment+value"></a>

richTextFragment.value() ⇒ <code>string</code>

Gets the value of this part of rich text

Kind: instance method of <code>RichTextFragment</code>
Returns: <code>string</code> - text
<a name="RichTextFragment+value"></a>

richTextFragment.value(text) ⇒ <code>RichTextFragment</code>

Sets the value of this part of rich text

Kind: instance method of <code>RichTextFragment</code>
Returns: <code>RichTextFragment</code> - - RichTextFragment

ParamTypeDescription
text<code>string</code>the text to set

<a name="RichTextFragment+style"></a>

richTextFragment.style(name) ⇒ <code>*</code>

Gets an individual style.

Kind: instance method of <code>RichTextFragment</code>
Returns: <code>*</code> - The style.

ParamTypeDescription
name<code>string</code>The name of the style.

<a name="RichTextFragment+style"></a>

richTextFragment.style(names) ⇒ <code>object.<string, *></code>

Gets multiple styles.

Kind: instance method of <code>RichTextFragment</code>
Returns: <code>object.<string, *></code> - Object whose keys are the style names and values are the styles.

ParamTypeDescription
names<code>Array.<string></code>The names of the style.

<a name="RichTextFragment+style"></a>

richTextFragment.style(name, value) ⇒ <code>RichTextFragment</code>

Sets an individual style.

Kind: instance method of <code>RichTextFragment</code>
Returns: <code>RichTextFragment</code> - This RichTextFragment.

ParamTypeDescription
name<code>string</code>The name of the style.
value<code>*</code>The value to set.

<a name="RichTextFragment+style"></a>

richTextFragment.style(styles) ⇒ <code>RichTextFragment</code>

Sets multiple styles.

Kind: instance method of <code>RichTextFragment</code>
Returns: <code>RichTextFragment</code> - This RichTextFragment.

ParamTypeDescription
styles<code>object.<string, *></code>Object whose keys are the style names and values are the styles to set.

<a name="Row"></a>

Row

A row.

Kind: global class

<a name="Row+address"></a>

row.address([opts]) ⇒ <code>string</code>

Get the address of the row.

Kind: instance method of <code>Row</code>
Returns: <code>string</code> - The address

ParamTypeDescription
[opts]<code>Object</code>Options
[opts.includeSheetName]<code>boolean</code>Include the sheet name in the address.
[opts.anchored]<code>boolean</code>Anchor the address.

<a name="Row+cell"></a>

row.cell(columnNameOrNumber) ⇒ <code>Cell</code>

Get a cell in the row.

Kind: instance method of <code>Row</code>
Returns: <code>Cell</code> - The cell.

ParamTypeDescription
columnNameOrNumber<code>string</code> | <code>number</code>The name or number of the column.

<a name="Row+height"></a>

row.height() ⇒ <code>undefined</code> | <code>number</code>

Gets the row height.

Kind: instance method of <code>Row</code>
Returns: <code>undefined</code> | <code>number</code> - The height (or undefined).
<a name="Row+height"></a>

row.height(height) ⇒ <code>Row</code>

Sets the row height.

Kind: instance method of <code>Row</code>
Returns: <code>Row</code> - The row.

ParamTypeDescription
height<code>number</code>The height of the row.

<a name="Row+hidden"></a>

row.hidden() ⇒ <code>boolean</code>

Gets a value indicating whether the row is hidden.

Kind: instance method of <code>Row</code>
Returns: <code>boolean</code> - A flag indicating whether the row is hidden.
<a name="Row+hidden"></a>

row.hidden(hidden) ⇒ <code>Row</code>

Sets whether the row is hidden.

Kind: instance method of <code>Row</code>
Returns: <code>Row</code> - The row.

ParamTypeDescription
hidden<code>boolean</code>A flag indicating whether to hide the row.

<a name="Row+rowNumber"></a>

row.rowNumber() ⇒ <code>number</code>

Gets the row number.

Kind: instance method of <code>Row</code>
Returns: <code>number</code> - The row number.
<a name="Row+sheet"></a>

row.sheet() ⇒ <code>Sheet</code>

Gets the parent sheet of the row.

Kind: instance method of <code>Row</code>
Returns: <code>Sheet</code> - The parent sheet.
<a name="Row+style"></a>

row.style(name) ⇒ <code>*</code>

Gets an individual style.

Kind: instance method of <code>Row</code>
Returns: <code>*</code> - The style.

ParamTypeDescription
name<code>string</code>The name of the style.

<a name="Row+style"></a>

row.style(names) ⇒ <code>object.<string, *></code>

Gets multiple styles.

Kind: instance method of <code>Row</code>
Returns: <code>object.<string, *></code> - Object whose keys are the style names and values are the styles.

ParamTypeDescription
names<code>Array.<string></code>The names of the style.

<a name="Row+style"></a>

row.style(name, value) ⇒ <code>Cell</code>

Sets an individual style.

Kind: instance method of <code>Row</code>
Returns: <code>Cell</code> - The cell.

ParamTypeDescription
name<code>string</code>The name of the style.
value<code>*</code>The value to set.

<a name="Row+style"></a>

row.style(styles) ⇒ <code>Cell</code>

Sets multiple styles.

Kind: instance method of <code>Row</code>
Returns: <code>Cell</code> - The cell.

ParamTypeDescription
styles<code>object.<string, *></code>Object whose keys are the style names and values are the styles to set.

<a name="Row+style"></a>

row.style(style) ⇒ <code>Cell</code>

Sets to a specific style

Kind: instance method of <code>Row</code>
Returns: <code>Cell</code> - The cell.

ParamTypeDescription
style<code>Style</code>Style object given from stylesheet.createStyle

<a name="Row+workbook"></a>

row.workbook() ⇒ <code>Workbook</code>

Get the parent workbook.

Kind: instance method of <code>Row</code>
Returns: <code>Workbook</code> - The parent workbook.
<a name="Row+addPageBreak"></a>

row.addPageBreak() ⇒ <code>Row</code>

Append horizontal page break after the row.

Kind: instance method of <code>Row</code>
Returns: <code>Row</code> - the row.
<a name="Sheet"></a>

Sheet

A worksheet.

Kind: global class

<a name="Sheet+active"></a>

sheet.active() ⇒ <code>boolean</code>

Gets a value indicating whether the sheet is the active sheet in the workbook.

Kind: instance method of <code>Sheet</code>
Returns: <code>boolean</code> - True if active, false otherwise.
<a name="Sheet+active"></a>

sheet.active(active) ⇒ <code>Sheet</code>

Make the sheet the active sheet in the workkbok.

Kind: instance method of <code>Sheet</code>
Returns: <code>Sheet</code> - The sheet.

ParamTypeDescription
active<code>boolean</code>Must be set to true. Deactivating directly is not supported. To deactivate, you should activate a different sheet instead.

<a name="Sheet+activeCell"></a>

sheet.activeCell() ⇒ <code>Cell</code>

Get the active cell in the sheet.

Kind: instance method of <code>Sheet</code>
Returns: <code>Cell</code> - The active cell.
<a name="Sheet+activeCell"></a>

sheet.activeCell(cell) ⇒ <code>Sheet</code>

Set the active cell in the workbook.

Kind: instance method of <code>Sheet</code>
Returns: <code>Sheet</code> - The sheet.

ParamTypeDescription
cell<code>string</code> | <code>Cell</code>The cell or address of cell to activate.

<a name="Sheet+activeCell"></a>

sheet.activeCell(rowNumber, columnNameOrNumber) ⇒ <code>Sheet</code>

Set the active cell in the workbook by row and column.

Kind: instance method of <code>Sheet</code>
Returns: <code>Sheet</code> - The sheet.

ParamTypeDescription
rowNumber<code>number</code>The row number of the cell.
columnNameOrNumber<code>string</code> | <code>number</code>The column name or number of the cell.

<a name="Sheet+cell"></a>

sheet.cell(address) ⇒ <code>Cell</code>

Gets the cell with the given address.

Kind: instance method of <code>Sheet</code>
Returns: <code>Cell</code> - The cell.

ParamTypeDescription
address<code>string</code>The address of the cell.

<a name="Sheet+cell"></a>

sheet.cell(rowNumber, columnNameOrNumber) ⇒ <code>Cell</code>

Gets the cell with the given row and column numbers.

Kind: instance method of <code>Sheet</code>
Returns: <code>Cell</code> - The cell.

ParamTypeDescription
rowNumber<code>number</code>The row number of the cell.
columnNameOrNumber<code>string</code> | <code>number</code>The column name or number of the cell.

<a name="Sheet+column"></a>

sheet.column(columnNameOrNumber) ⇒ <code>Column</code>

Gets a column in the sheet.

Kind: instance method of <code>Sheet</code>
Returns: <code>Column</code> - The column.

ParamTypeDescription
columnNameOrNumber<code>string</code> | <code>number</code>The name or number of the column.

<a name="Sheet+definedName"></a>

sheet.definedName(name) ⇒ <code>undefined</code> | <code>string</code> | <code>Cell</code> | <code>Range</code> | <code>Row</code> | <code>Column</code>

Gets a defined name scoped to the sheet.

Kind: instance method of <code>Sheet</code>
Returns: <code>undefined</code> | <code>string</code> | <code>Cell</code> | <code>Range</code> | <code>Row</code> | <code>Column</code> - What the defined name refers to or undefined if not found. Will return the string formula if not a Row, Column, Cell, or Range.

ParamTypeDescription
name<code>string</code>The defined name.

<a name="Sheet+definedName"></a>

sheet.definedName(name, refersTo) ⇒ <code>Workbook</code>

Set a defined name scoped to the sheet.

Kind: instance method of <code>Sheet</code>
Returns: <code>Workbook</code> - The workbook.

ParamTypeDescription
name<code>string</code>The defined name.
refersTo<code>string</code> | <code>Cell</code> | <code>Range</code> | <code>Row</code> | <code>Column</code>What the name refers to.

<a name="Sheet+delete"></a>

sheet.delete() ⇒ <code>Workbook</code>

Deletes the sheet and returns the parent workbook.

Kind: instance method of <code>Sheet</code>
Returns: <code>Workbook</code> - The workbook.
<a name="Sheet+find"></a>

sheet.find(pattern, [replacement]) ⇒ <code>Array.<Cell></code>

Find the given pattern in the sheet and optionally replace it.

Kind: instance method of <code>Sheet</code>
Returns: <code>Array.<Cell></code> - The matching cells.

ParamTypeDescription
pattern<code>string</code> | <code>RegExp</code>The pattern to look for. Providing a string will result in a case-insensitive substring search. Use a RegExp for more sophisticated searches.
[replacement]<code>string</code> | <code>function</code>The text to replace or a String.replace callback function. If pattern is a string, all occurrences of the pattern in each cell will be replaced.

<a name="Sheet+gridLinesVisible"></a>

sheet.gridLinesVisible() ⇒ <code>boolean</code>

Gets a value indicating whether this sheet's grid lines are visible.

Kind: instance method of <code>Sheet</code>
Returns: <code>boolean</code> - True if selected, false if not.
<a name="Sheet+gridLinesVisible"></a>

sheet.gridLinesVisible(selected) ⇒ <code>Sheet</code>

Sets whether this sheet's grid lines are visible.

Kind: instance method of <code>Sheet</code>
Returns: <code>Sheet</code> - The sheet.

ParamTypeDescription
selected<code>boolean</code>True to make visible, false to hide.

<a name="Sheet+hidden"></a>

sheet.hidden() ⇒ <code>boolean</code> | <code>string</code>

Gets a value indicating if the sheet is hidden or not.

Kind: instance method of <code>Sheet</code>
Returns: <code>boolean</code> | <code>string</code> - True if hidden, false if visible, and 'very' if very hidden.
<a name="Sheet+hidden"></a>

sheet.hidden(hidden) ⇒ <code>Sheet</code>

Set whether the sheet is hidden or not.

Kind: instance method of <code>Sheet</code>
Returns: <code>Sheet</code> - The sheet.

ParamTypeDescription
hidden<code>boolean</code> | <code>string</code>True to hide, false to show, and 'very' to make very hidden.

<a name="Sheet+move"></a>

sheet.move([indexOrBeforeSheet]) ⇒ <code>Sheet</code>

Move the sheet.

Kind: instance method of <code>Sheet</code>
Returns: <code>Sheet</code> - The sheet.

ParamTypeDescription
[indexOrBeforeSheet]<code>number</code> | <code>string</code> | <code>Sheet</code>The index to move the sheet to or the sheet (or name of sheet) to move this sheet before. Omit this argument to move to the end of the workbook.

<a name="Sheet+name"></a>

sheet.name() ⇒ <code>string</code>

Get the name of the sheet.

Kind: instance method of <code>Sheet</code>
Returns: <code>string</code> - The sheet name.
<a name="Sheet+name"></a>

sheet.name(name) ⇒ <code>Sheet</code>

Set the name of the sheet. Note: this method does not rename references to the sheet so formulas, etc. can be broken. Use with caution!

Kind: instance method of <code>Sheet</code>
Returns: <code>Sheet</code> - The sheet.

ParamTypeDescription
name<code>string</code>The name to set to the sheet.

<a name="Sheet+range"></a>

sheet.range(address) ⇒ <code>Range</code>

Gets a range from the given range address.

Kind: instance method of <code>Sheet</code>
Returns: <code>Range</code> - The range.

ParamTypeDescription
address<code>string</code>The range address (e.g. 'A1:B3').

<a name="Sheet+range"></a>

sheet.range(startCell, endCell) ⇒ <code>Range</code>

Gets a range from the given cells or cell addresses.

Kind: instance method of <code>Sheet</code>
Returns: <code>Range</code> - The range.

ParamTypeDescription
startCell<code>string</code> | <code>Cell</code>The starting cell or cell address (e.g. 'A1').
endCell<code>string</code> | <code>Cell</code>The ending cell or cell address (e.g. 'B3').

<a name="Sheet+range"></a>

sheet.range(startRowNumber, startColumnNameOrNumber, endRowNumber, endColumnNameOrNumber) ⇒ <code>Range</code>

Gets a range from the given row numbers and column names or numbers.

Kind: instance method of <code>Sheet</code>
Returns: <code>Range</code> - The range.

ParamTypeDescription
startRowNumber<code>number</code>The starting cell row number.
startColumnNameOrNumber<code>string</code> | <code>number</code>The starting cell column name or number.
endRowNumber<code>number</code>The ending cell row number.
endColumnNameOrNumber<code>string</code> | <code>number</code>The ending cell column name or number.

<a name="Sheet+autoFilter"></a>

sheet.autoFilter() ⇒ <code>Sheet</code>

Unsets sheet autoFilter.

Kind: instance method of <code>Sheet</code>
Returns: <code>Sheet</code> - This sheet.
<a name="Sheet+autoFilter"></a>

sheet.autoFilter(range) ⇒ <code>Sheet</code>

Sets sheet autoFilter to a Range.

Kind: instance method of <code>Sheet</code>
Returns: <code>Sheet</code> - This sheet.

ParamTypeDescription
range<code>Range</code>The autoFilter range.

<a name="Sheet+row"></a>

sheet.row(rowNumber) ⇒ <code>Row</code>

Gets the row with the given number.

Kind: instance method of <code>Sheet</code>
Returns: <code>Row</code> - The row with the given number.

ParamTypeDescription
rowNumber<code>number</code>The row number.

<a name="Sheet+tabColor"></a>

sheet.tabColor() ⇒ <code>undefined</code> | <code>Color</code>

Get the tab color. (See style Color.)

Kind: instance method of <code>Sheet</code>
Returns: <code>undefined</code> | <code>Color</code> - The color or undefined if not set.
<a name="Sheet+tabColor"></a>

sheet.tabColor() ⇒ <code>Color</code> | <code>string</code> | <code>number</code>

Sets the tab color. (See style Color.)

Kind: instance method of <code>Sheet</code>
Returns: <code>Color</code> | <code>string</code> | <code>number</code> - color - Color of the tab. If string, will set an RGB color. If number, will set a theme color.
<a name="Sheet+tabSelected"></a>

sheet.tabSelected() ⇒ <code>boolean</code>

Gets a value indicating whether this sheet is selected.

Kind: instance method of <code>Sheet</code>
Returns: <code>boolean</code> - True if selected, false if not.
<a name="Sheet+tabSelected"></a>

sheet.tabSelected(selected) ⇒ <code>Sheet</code>

Sets whether this sheet is selected.

Kind: instance method of <code>Sheet</code>
Returns: <code>Sheet</code> - The sheet.

ParamTypeDescription
selected<code>boolean</code>True to select, false to deselected.

<a name="Sheet+rightToLeft"></a>

sheet.rightToLeft() ⇒ <code>boolean</code>

Gets a value indicating whether this sheet is rtl (Right To Left).

Kind: instance method of <code>Sheet</code>
Returns: <code>boolean</code> - True if rtl, false if ltr.
<a name="Sheet+rightToLeft"></a>

sheet.rightToLeft(rtl) ⇒ <code>Sheet</code>

Sets whether this sheet is rtl.

Kind: instance method of <code>Sheet</code>
Returns: <code>Sheet</code> - The sheet.

ParamTypeDescription
rtl<code>boolean</code>True to rtl, false to ltr (Left To Right).

<a name="Sheet+usedRange"></a>

sheet.usedRange() ⇒ <code>Range</code> | <code>undefined</code>

Get the range of cells in the sheet that have contained a value or style at any point. Useful for extracting the entire sheet contents.

Kind: instance method of <code>Sheet</code>
Returns: <code>Range</code> | <code>undefined</code> - The used range or undefined if no cells in the sheet are used.
<a name="Sheet+workbook"></a>

sheet.workbook() ⇒ <code>Workbook</code>

Gets the parent workbook.

Kind: instance method of <code>Sheet</code>
Returns: <code>Workbook</code> - The parent workbook.
<a name="Sheet+pageBreaks"></a>

sheet.pageBreaks() ⇒ <code>Object</code>

Gets all page breaks.

Kind: instance method of <code>Sheet</code>
Returns: <code>Object</code> - the object holds both vertical and horizontal PageBreaks.
<a name="Sheet+verticalPageBreaks"></a>

sheet.verticalPageBreaks() ⇒ <code>PageBreaks</code>

Gets the vertical page breaks.

Kind: instance method of <code>Sheet</code>
Returns: <code>PageBreaks</code> - vertical PageBreaks.
<a name="Sheet+horizontalPageBreaks"></a>

sheet.horizontalPageBreaks() ⇒ <code>PageBreaks</code>

Gets the horizontal page breaks.

Kind: instance method of <code>Sheet</code>
Returns: <code>PageBreaks</code> - horizontal PageBreaks.
<a name="Sheet+hyperlink"></a>

sheet.hyperlink(address) ⇒ <code>string</code> | <code>undefined</code>

Get the hyperlink attached to the cell with the given address.

Kind: instance method of <code>Sheet</code>
Returns: <code>string</code> | <code>undefined</code> - The hyperlink or undefined if not set.

ParamTypeDescription
address<code>string</code>The address of the hyperlinked cell.

<a name="Sheet+hyperlink"></a>

sheet.hyperlink(address, hyperlink, [internal]) ⇒ <code>Sheet</code>

Set the hyperlink on the cell with the given address.

Kind: instance method of <code>Sheet</code>
Returns: <code>Sheet</code> - The sheet.

ParamTypeDescription
address<code>string</code>The address of the hyperlinked cell.
hyperlink<code>string</code>The hyperlink to set or undefined to clear.
[internal]<code>boolean</code>The flag to force hyperlink to be internal. If true, then autodetect is skipped.

<a name="Sheet+hyperlink"></a>

sheet.hyperlink(address, opts) ⇒ <code>Sheet</code>

Set the hyperlink on the cell with the given address and options.

Kind: instance method of <code>Sheet</code>
Returns: <code>Sheet</code> - The sheet.

ParamTypeDescription
address<code>string</code>The address of the hyperlinked cell.
opts<code>Object</code> | <code>Cell</code>Options or Cell. If opts is a Cell then an internal hyperlink is added.
[opts.hyperlink]<code>string</code> | <code>Cell</code>The hyperlink to set, can be a Cell or an internal/external string.
[opts.tooltip]<code>string</code>Additional text to help the user understand more about the hyperlink.
[opts.email]<code>string</code>Email address, ignored if opts.hyperlink is set.
[opts.emailSubject]<code>string</code>Email subject, ignored if opts.hyperlink is set.

<a name="Sheet+printOptions"></a>

sheet.printOptions(attributeName) ⇒ <code>boolean</code>

Get the print option given a valid print option attribute.

Kind: instance method of <code>Sheet</code>

ParamTypeDescription
attributeName<code>string</code>Attribute name of the printOptions. gridLines - Used in conjunction with gridLinesSet. If both gridLines and gridlinesSet are true, then grid lines shall print. Otherwise, they shall not (i.e., one or both have false values). gridLinesSet - Used in conjunction with gridLines. If both gridLines and gridLinesSet are true, then grid lines shall print. Otherwise, they shall not (i.e., one or both have false values). headings - Print row and column headings. horizontalCentered - Center on page horizontally when printing. verticalCentered - Center on page vertically when printing.

<a name="Sheet+printOptions"></a>

sheet.printOptions(attributeName, attributeEnabled) ⇒ <code>Sheet</code>

Set the print option given a valid print option attribute and a value.

Kind: instance method of <code>Sheet</code>
Returns: <code>Sheet</code> - The sheet.

ParamTypeDescription
attributeName<code>string</code>Attribute name of the printOptions. See get print option for list of valid attributes.
attributeEnabled<code>undefined</code> | <code>boolean</code>If undefined or false then the attribute is removed, otherwise the print option is enabled.

<a name="Sheet+printGridLines"></a>

sheet.printGridLines() ⇒ <code>boolean</code>

Get the print option for the gridLines attribute value.

Kind: instance method of <code>Sheet</code>
<a name="Sheet+printGridLines"></a>

sheet.printGridLines(enabled) ⇒ <code>Sheet</code>

Set the print option for the gridLines attribute value.

Kind: instance method of <code>Sheet</code>
Returns: <code>Sheet</code> - The sheet.

ParamTypeDescription
enabled<code>undefined</code> | <code>boolean</code>If undefined or false then attribute is removed, otherwise gridLines is enabled.

<a name="Sheet+pageMargins"></a>

sheet.pageMargins(attributeName) ⇒ <code>number</code>

Get the page margin given a valid attribute name. If the value is not yet defined, then it will return the current preset value.

Kind: instance method of <code>Sheet</code>
Returns: <code>number</code> - the attribute value.

ParamTypeDescription
attributeName<code>string</code>Attribute name of the pageMargins. left - Left Page Margin in inches. right - Right page margin in inches. top - Top Page Margin in inches. buttom - Bottom Page Margin in inches. footer - Footer Page Margin in inches. header - Header Page Margin in inches.

<a name="Sheet+pageMargins"></a>

sheet.pageMargins(attributeName, attributeStringValue) ⇒ <code>Sheet</code>

Set the page margin (or override the preset) given an attribute name and a value.

Kind: instance method of <code>Sheet</code>
Returns: <code>Sheet</code> - The sheet.

ParamTypeDescription
attributeName<code>string</code>Attribute name of the pageMargins. See get page margin for list of valid attributes.
attributeStringValue<code>undefined</code> | <code>number</code> | <code>string</code>If undefined then set back to preset value, otherwise, set the given attribute value.

<a name="Sheet+pageMarginsPreset"></a>

sheet.pageMarginsPreset() ⇒ <code>string</code>

Page margins preset is a set of page margins associated with a name. The page margin preset acts as a fallback when not explicitly defined by Sheet.pageMargins. If a sheet already contains page margins, it attempts to auto-detect, otherwise they are defined as the template preset. If no page margins exist, then the preset is undefined and will not be included in the output of Sheet.toXmls. Available presets include: normal, wide, narrow, template.

Get the page margins preset name. The registered name of a predefined set of attributes.

Kind: instance method of <code>Sheet</code>
Returns: <code>string</code> - The preset name.
<a name="Sheet+pageMarginsPreset"></a>

sheet.pageMarginsPreset(presetName) ⇒ <code>Sheet</code>

Set the page margins preset by name, clearing any existing/temporary attribute values.

Kind: instance method of <code>Sheet</code>
Returns: <code>Sheet</code> - The sheet.

ParamTypeDescription
presetName<code>undefined</code> | <code>string</code>The preset name. If undefined, page margins will not be included in the output of Sheet.toXmls.

<a name="Sheet+pageMarginsPreset"></a>

sheet.pageMarginsPreset(presetName, presetAttributes) ⇒ <code>Sheet</code>

Set a new page margins preset by name and attributes object.

Kind: instance method of <code>Sheet</code>
Returns: <code>Sheet</code> - The sheet.

ParamTypeDescription
presetName<code>string</code>The preset name.
presetAttributes<code>object</code>The preset attributes.

<a name="Sheet+panes"></a>

sheet.panes() ⇒ <code>PaneOptions</code>

Gets sheet view pane options

Kind: instance method of <code>Sheet</code>
Returns: <code>PaneOptions</code> - sheet view pane options
<a name="Sheet+panes"></a>

sheet.panes(paneOptions) ⇒ <code>Sheet</code>

Sets sheet view pane options

Kind: instance method of <code>Sheet</code>
Returns: <code>Sheet</code> - The sheet

ParamTypeDescription
paneOptions<code>PaneOptions</code> | <code>null</code> | <code>undefined</code>sheet view pane options

<a name="Sheet+freezePanes"></a>

sheet.freezePanes(xSplit, ySplit) ⇒ <code>Sheet</code>

Freezes Panes for this sheet.

Kind: instance method of <code>Sheet</code>
Returns: <code>Sheet</code> - The sheet

ParamTypeDescription
xSplit<code>number</code>the number of columns visible in the top pane. 0 (zero) if none.
ySplit<code>number</code>the number of rows visible in the left pane. 0 (zero) if none.

<a name="Sheet+freezePanes"></a>

sheet.freezePanes(topLeftCell) ⇒ <code>Sheet</code>

freezes Panes for this sheet.

Kind: instance method of <code>Sheet</code>
Returns: <code>Sheet</code> - The sheet

ParamTypeDescription
topLeftCell<code>string</code>Top Left Visible Cell. Location of the top left visible cell in the bottom right pane (when in Left-To-Right mode).

<a name="Sheet+splitPanes"></a>

sheet.splitPanes(xSplit, ySplit) ⇒ <code>Sheet</code>

Splits Panes for this sheet.

Kind: instance method of <code>Sheet</code>
Returns: <code>Sheet</code> - The sheet

ParamTypeDescription
xSplit<code>number</code>(Horizontal Split Position) Horizontal position of the split, in 1/20th of a point; 0 (zero) if none.
ySplit<code>number</code>(Vertical Split Position) VVertical position of the split, in 1/20th of a point; 0 (zero) if none.

<a name="Sheet+resetPanes"></a>

sheet.resetPanes() ⇒ <code>Sheet</code>

resets to default sheet view panes.

Kind: instance method of <code>Sheet</code>
Returns: <code>Sheet</code> - The sheet
<a name="Workbook"></a>

Workbook

A workbook.

Kind: global class

<a name="Workbook+activeSheet"></a>

workbook.activeSheet() ⇒ <code>Sheet</code>

Get the active sheet in the workbook.

Kind: instance method of <code>Workbook</code>
Returns: <code>Sheet</code> - The active sheet.
<a name="Workbook+activeSheet"></a>

workbook.activeSheet(sheet) ⇒ <code>Workbook</code>

Set the active sheet in the workbook.

Kind: instance method of <code>Workbook</code>
Returns: <code>Workbook</code> - The workbook.

ParamTypeDescription
sheet<code>Sheet</code> | <code>string</code> | <code>number</code>The sheet or name of sheet or index of sheet to activate. The sheet must not be hidden.

<a name="Workbook+addSheet"></a>

workbook.addSheet(name, [indexOrBeforeSheet]) ⇒ <code>Sheet</code>

Add a new sheet to the workbook.

Kind: instance method of <code>Workbook</code>
Returns: <code>Sheet</code> - The new sheet.

ParamTypeDescription
name<code>string</code>The name of the sheet. Must be unique, less than 31 characters, and may not contain the following characters: \ / * [ ] : ?
[indexOrBeforeSheet]<code>number</code> | <code>string</code> | <code>Sheet</code>The index to move the sheet to or the sheet (or name of sheet) to move this sheet before. Omit this argument to move to the end of the workbook.

<a name="Workbook+definedName"></a>

workbook.definedName(name) ⇒ <code>undefined</code> | <code>string</code> | <code>Cell</code> | <code>Range</code> | <code>Row</code> | <code>Column</code>

Gets a defined name scoped to the workbook.

Kind: instance method of <code>Workbook</code>
Returns: <code>undefined</code> | <code>string</code> | <code>Cell</code> | <code>Range</code> | <code>Row</code> | <code>Column</code> - What the defined name refers to or undefined if not found. Will return the string formula if not a Row, Column, Cell, or Range.

ParamTypeDescription
name<code>string</code>The defined name.

<a name="Workbook+definedName"></a>

workbook.definedName(name, refersTo) ⇒ <code>Workbook</code>

Set a defined name scoped to the workbook.

Kind: instance method of <code>Workbook</code>
Returns: <code>Workbook</code> - The workbook.

ParamTypeDescription
name<code>string</code>The defined name.
refersTo<code>string</code> | <code>Cell</code> | <code>Range</code> | <code>Row</code> | <code>Column</code>What the name refers to.

<a name="Workbook+deleteSheet"></a>

workbook.deleteSheet(sheet) ⇒ <code>Workbook</code>

Delete a sheet from the workbook.

Kind: instance method of <code>Workbook</code>
Returns: <code>Workbook</code> - The workbook.

ParamTypeDescription
sheet<code>Sheet</code> | <code>string</code> | <code>number</code>The sheet or name of sheet or index of sheet to move.

<a name="Workbook+find"></a>

workbook.find(pattern, [replacement]) ⇒ <code>boolean</code>

Find the given pattern in the workbook and optionally replace it.

Kind: instance method of <code>Workbook</code>
Returns: <code>boolean</code> - A flag indicating if the pattern was found.

ParamTypeDescription
pattern<code>string</code> | <code>RegExp</code>The pattern to look for. Providing a string will result in a case-insensitive substring search. Use a RegExp for more sophisticated searches.
[replacement]<code>string</code> | <code>function</code>The text to replace or a String.replace callback function. If pattern is a string, all occurrences of the pattern in each cell will be replaced.

<a name="Workbook+moveSheet"></a>

workbook.moveSheet(sheet, [indexOrBeforeSheet]) ⇒ <code>Workbook</code>

Move a sheet to a new position.

Kind: instance method of <code>Workbook</code>
Returns: <code>Workbook</code> - The workbook.

ParamTypeDescription
sheet<code>Sheet</code> | <code>string</code> | <code>number</code>The sheet or name of sheet or index of sheet to move.
[indexOrBeforeSheet]<code>number</code> | <code>string</code> | <code>Sheet</code>The index to move the sheet to or the sheet (or name of sheet) to move this sheet before. Omit this argument to move to the end of the workbook.

<a name="Workbook+outputAsync"></a>

workbook.outputAsync([type]) ⇒ <code>Promise.<(string|Uint8Array|ArrayBuffer|Blob|Buffer)></code>

Generates the workbook output.

Kind: instance method of <code>Workbook</code>
Returns: <code>Promise.<(string|Uint8Array|ArrayBuffer|Blob|Buffer)></code> - The data.

ParamTypeDescription
[type]<code>string</code>The type of the data to return: base64, binarystring, uint8array, arraybuffer, blob, nodebuffer. Defaults to 'nodebuffer' in Node.js and 'blob' in browsers.

<a name="Workbook+outputAsync"></a>

workbook.outputAsync([opts]) ⇒ <code>Promise.<(string|Uint8Array|ArrayBuffer|Blob|Buffer)></code>

Generates the workbook output.

Kind: instance method of <code>Workbook</code>
Returns: <code>Promise.<(string|Uint8Array|ArrayBuffer|Blob|Buffer)></code> - The data.

ParamTypeDescription
[opts]<code>Object</code>Options
[opts.type]<code>string</code>The type of the data to return: base64, binarystring, uint8array, arraybuffer, blob, nodebuffer. Defaults to 'nodebuffer' in Node.js and 'blob' in browsers.
[opts.password]<code>string</code>The password to use to encrypt the workbook.

<a name="Workbook+sheet"></a>

workbook.sheet(sheetNameOrIndex) ⇒ <code>Sheet</code> | <code>undefined</code>

Gets the sheet with the provided name or index (0-based).

Kind: instance method of <code>Workbook</code>
Returns: <code>Sheet</code> | <code>undefined</code> - The sheet or undefined if not found.

ParamTypeDescription
sheetNameOrIndex<code>string</code> | <code>number</code>The sheet name or index.

<a name="Workbook+sheets"></a>

workbook.sheets() ⇒ <code>Array.<Sheet></code>

Get an array of all the sheets in the workbook.

Kind: instance method of <code>Workbook</code>
Returns: <code>Array.<Sheet></code> - The sheets.
<a name="Workbook+property"></a>

workbook.property(name) ⇒ <code>*</code>

Gets an individual property.

Kind: instance method of <code>Workbook</code>
Returns: <code>*</code> - The property.

ParamTypeDescription
name<code>string</code>The name of the property.

<a name="Workbook+property"></a>

workbook.property(names) ⇒ <code>object.<string, *></code>

Gets multiple properties.

Kind: instance method of <code>Workbook</code>
Returns: <code>object.<string, *></code> - Object whose keys are the property names and values are the properties.

ParamTypeDescription
names<code>Array.<string></code>The names of the properties.

<a name="Workbook+property"></a>

workbook.property(name, value) ⇒ <code>Workbook</code>

Sets an individual property.

Kind: instance method of <code>Workbook</code>
Returns: <code>Workbook</code> - The workbook.

ParamTypeDescription
name<code>string</code>The name of the property.
value<code>*</code>The value to set.

<a name="Workbook+property"></a>

workbook.property(properties) ⇒ <code>Workbook</code>

Sets multiple properties.

Kind: instance method of <code>Workbook</code>
Returns: <code>Workbook</code> - The workbook.

ParamTypeDescription
properties<code>object.<string, *></code>Object whose keys are the property names and values are the values to set.

<a name="Workbook+properties"></a>

workbook.properties() ⇒ <code>CoreProperties</code>

Get access to core properties object

Kind: instance method of <code>Workbook</code>
Returns: <code>CoreProperties</code> - The core properties.
<a name="Workbook+toFileAsync"></a>

workbook.toFileAsync(path, [opts]) ⇒ <code>Promise.<undefined></code>

Write the workbook to file. (Not supported in browsers.)

Kind: instance method of <code>Workbook</code>
Returns: <code>Promise.<undefined></code> - A promise.

ParamTypeDescription
path<code>string</code>The path of the file to write.
[opts]<code>Object</code>Options
[opts.password]<code>string</code>The password to encrypt the workbook.

<a name="Workbook+cloneSheet"></a>

workbook.cloneSheet(from, name, [indexOrBeforeSheet]) ⇒ <code>Sheet</code>

Add a new sheet to the workbook.

WARN: this function has limits: if you clone a sheet with some images or other things link outside the Sheet object, these things in the cloned sheet will be locked when you open in MS Excel app.

Kind: instance method of <code>Workbook</code>
Returns: <code>Sheet</code> - The new sheet.

ParamTypeDescription
from<code>Sheet</code>The sheet to be cloned.
name<code>string</code>The name of the new sheet. Must be unique, less than 31 characters, and may not contain the following characters: \ / * [ ] : ?
[indexOrBeforeSheet]<code>number</code> | <code>string</code> | <code>Sheet</code>The index to move the sheet to or the sheet (or name of sheet) to move this sheet before. Omit this argument to move to the end of the workbook.

<a name="XlsxPopulate"></a>

XlsxPopulate : <code>object</code>

Kind: global namespace

<a name="XlsxPopulate.Promise"></a>

XlsxPopulate.Promise : <code>Promise</code>

The Promise library.

Kind: static property of <code>XlsxPopulate</code>
<a name="XlsxPopulate.MIME_TYPE"></a>

XlsxPopulate.MIME_TYPE : <code>string</code>

The XLSX mime type.

Kind: static property of <code>XlsxPopulate</code>
<a name="XlsxPopulate.FormulaError"></a>

XlsxPopulate.FormulaError : <code>FormulaError</code>

Formula error class.

Kind: static property of <code>XlsxPopulate</code>
<a name="XlsxPopulate.RichText"></a>

XlsxPopulate.RichText : <code>RichText</code>

RichTexts class

Kind: static property of <code>XlsxPopulate</code>
<a name="XlsxPopulate.dateToNumber"></a>

XlsxPopulate.dateToNumber(date) ⇒ <code>number</code>

Convert a date to a number for Excel.

Kind: static method of <code>XlsxPopulate</code>
Returns: <code>number</code> - The number.

ParamTypeDescription
date<code>Date</code>The date.

<a name="XlsxPopulate.fromBlankAsync"></a>

XlsxPopulate.fromBlankAsync() ⇒ <code>Promise.<Workbook></code>

Create a new blank workbook.

Kind: static method of <code>XlsxPopulate</code>
Returns: <code>Promise.<Workbook></code> - The workbook.
<a name="XlsxPopulate.fromDataAsync"></a>

XlsxPopulate.fromDataAsync(data, [opts]) ⇒ <code>Promise.<Workbook></code>

Loads a workbook from a data object. (Supports any supported JSZip data types.)

Kind: static method of <code>XlsxPopulate</code>
Returns: <code>Promise.<Workbook></code> - The workbook.

ParamTypeDescription
data<code>string</code> | <code>Array.<number></code> | <code>ArrayBuffer</code> | <code>Uint8Array</code> | <code>Buffer</code> | <code>Blob</code> | <code>Promise.<*></code>The data to load.
[opts]<code>Object</code>Options
[opts.password]<code>string</code>The password to decrypt the workbook.

<a name="XlsxPopulate.fromFileAsync"></a>

XlsxPopulate.fromFileAsync(path, [opts]) ⇒ <code>Promise.<Workbook></code>

Loads a workbook from file.

Kind: static method of <code>XlsxPopulate</code>
Returns: <code>Promise.<Workbook></code> - The workbook.

ParamTypeDescription
path<code>string</code>The path to the workbook.
[opts]<code>Object</code>Options
[opts.password]<code>string</code>The password to decrypt the workbook.

<a name="XlsxPopulate.numberToDate"></a>

XlsxPopulate.numberToDate(number) ⇒ <code>Date</code>

Convert an Excel number to a date.

Kind: static method of <code>XlsxPopulate</code>
Returns: <code>Date</code> - The date.

ParamTypeDescription
number<code>number</code>The number.

<a name="_"></a>

_

OOXML uses the CFB file format with Agile Encryption. The details of the encryption are here: https://msdn.microsoft.com/en-us/library/dd950165(v=office.12).aspx

Helpful guidance also take from this Github project: https://github.com/nolze/ms-offcrypto-tool

Kind: global constant
<a name="PaneOptions"></a>

PaneOptions : <code>Object</code>

https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.pane?view=openxml-2.8.1

Kind: global typedef
Properties

NameTypeDefaultDescription
activePane<code>string</code><code>"bottomRight"</code>Active Pane. The pane that is active.
state<code>string</code>Split State. Indicates whether the pane has horizontal / vertical splits, and whether those splits are frozen.
topLeftCell<code>string</code>Top Left Visible Cell. Location of the top left visible cell in the bottom right pane (when in Left-To-Right mode).
xSplit<code>number</code>(Horizontal Split Position) Horizontal position of the split, in 1/20th of a point; 0 (zero) if none. If the pane is frozen, this value indicates the number of columns visible in the top pane.
ySplit<code>number</code>(Vertical Split Position) Vertical position of the split, in 1/20th of a point; 0 (zero) if none. If the pane is frozen, this value indicates the number of rows visible in the left pane.