From 96eee3c7eb871a915f6283797193ba2292bd6eae Mon Sep 17 00:00:00 2001 From: Dan Dascalescu Date: Sat, 11 Sep 2021 01:33:48 -0700 Subject: [PATCH] Doc `json_to_sheet` cell type resolution [ci skip] --- docbits/82_util.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docbits/82_util.md b/docbits/82_util.md index c80c36b..e770fb6 100644 --- a/docbits/82_util.md +++ b/docbits/82_util.md @@ -102,7 +102,7 @@ XLSX.utils.sheet_add_aoa(ws, [[4,5,6,7,8,9,0]], {origin: -1}); `XLSX.utils.json_to_sheet` takes an array of objects and returns a worksheet with automatically-generated "headers" based on the keys of the objects. The default column order is determined by the first appearance of the field using -`Object.keys`, but can be overridden using the options argument: +`Object.keys`. The function accepts an options argument: | Option Name | Default | Description | | :---------- | :-----: | :--------------------------------------------------- | @@ -111,8 +111,10 @@ default column order is determined by the first appearance of the field using |`cellDates` | false | Store dates as type `d` (default is `n`) | |`skipHeader` | false | If true, do not include header row in output | -All fields from each row will be written. If `header` is supplied and the array -does not contain a particular field, the key will be appended to the array. +- All fields from each row will be written. If `header` is an array and it does + not contain a particular field, the key will be appended to the array. +- Cell types are deduced from the type of each value. For example, a `Date` + object will generate a Date cell, while a string will generate a Text cell.
Examples (click to show)