From ef21e2bea29236bb983c747d7c087b886aa7fef3 Mon Sep 17 00:00:00 2001 From: AndrewGlago Date: Tue, 9 Nov 2021 00:31:56 +0000 Subject: [PATCH] DSV Field Separator override [ci skip] --- bits/40_harb.js | 1 + docbits/80_parseopts.md | 1 + types/index.d.ts | 3 +++ 3 files changed, 5 insertions(+) diff --git a/bits/40_harb.js b/bits/40_harb.js index 7faf509..c85de61 100644 --- a/bits/40_harb.js +++ b/bits/40_harb.js @@ -873,6 +873,7 @@ var PRN = (function() { } else sep = guess_sep(str.slice(0,1024)); } + else if(o && o.FS) sep = o.FS; else sep = guess_sep(str.slice(0,1024)); var R = 0, C = 0, v = 0; var start = 0, end = 0, sepcc = sep.charCodeAt(0), instr = false, cc=0, startcc=str.charCodeAt(0); diff --git a/docbits/80_parseopts.md b/docbits/80_parseopts.md index 30d969f..e9374c6 100644 --- a/docbits/80_parseopts.md +++ b/docbits/80_parseopts.md @@ -26,6 +26,7 @@ The exported `read` and `readFile` functions accept an options argument: |`sheets` | | If specified, only parse specified sheets ** | |`PRN` | false | If true, allow parsing of PRN files ** | |`xlfn` | false | If true, preserve `_xlfn.` prefixes in formulae ** | +|`FS` | | DSV Field Separator override | - Even if `cellNF` is false, formatted text will be generated and saved to `.w` - In some cases, sheets may be parsed even if `bookSheets` is false. diff --git a/types/index.d.ts b/types/index.d.ts index c282c2d..f4a0588 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -163,6 +163,9 @@ export interface ParsingOptions extends CommonOptions { /** Override default date format (code 14) */ dateNF?: string; + /** Field Separator ("Delimiter" override) */ + FS?: string; + /** * If >0, read the first sheetRows rows * @default 0