CLI - convert all pages #701

Closed
opened 2017-06-20 05:38:42 +00:00 by pmelisko · 4 comments
pmelisko commented 2017-06-20 05:38:42 +00:00 (Migrated from github.com)

Hello, thanks for great work. I would like to ask if there is possibility to add switch to process all sheets at once. I.E. I am using js-xlsx as git differ for spreadsheets, but this script is too slow.

for sheetName in $(xlsx -q -l "$1"); do xlsx -q -s "$sheetName" "$1" done

It would be great to have some switch like --all-sheets, i.e:

xlsx -q --all-sheets "$1"

I forked your repo (https://github.com/gratex/js-xlsx/) to add similar feature, that without specified sheet it will convert all pages by default (not only the first).
Thanks in advance.

Hello, thanks for great work. I would like to ask if there is possibility to add switch to process all sheets at once. I.E. I am using js-xlsx as git differ for spreadsheets, but this script is too slow. `for sheetName in $(xlsx -q -l "$1"); do xlsx -q -s "$sheetName" "$1" done ` It would be great to have some switch like --all-sheets, i.e: `xlsx -q --all-sheets "$1"` I forked your repo (https://github.com/gratex/js-xlsx/) to add similar feature, that without specified sheet it will convert all pages by default (not only the first). Thanks in advance.
SheetJSDev commented 2017-06-20 06:02:29 +00:00 (Migrated from github.com)

@pmelisko it's obviously doable, but let's clarify some cases:

  1. currently the sheet name is written to standard error and the data is written to standard output. How does that change when dealing with multiple sheets? Should sheet name be written to standard out? Should there be a separate end-of-file marker?

  2. how should the file output forms (e.g. DIF or SYLK or CSV with the -o option) work with this flag? Should the script generate separate files or one concatenation? Should the file name take a pattern (like %b for basename, %s for sheet name, %n for index)

  3. should the formulae output prepend the sheet name? (e.g. 'Sheet1'!A1=3)

@pmelisko it's obviously doable, but let's clarify some cases: 1) currently the [sheet name is written to standard error](https://github.com/SheetJS/js-xlsx/blob/master/bin/xlsx.njs#L179) and the data is written to standard output. How does that change when dealing with multiple sheets? Should sheet name be written to standard out? Should there be a separate end-of-file marker? 2) how should the file output forms (e.g. DIF or SYLK or CSV with the -o option) work with this flag? Should the script generate separate files or one concatenation? Should the file name take a pattern (like `%b` for basename, `%s` for sheet name, `%n` for index) 3) should the formulae output prepend the sheet name? (e.g. `'Sheet1'!A1=3`)
pmelisko commented 2017-06-20 07:26:16 +00:00 (Migrated from github.com)

Those are the questions why i didn't prepare pull request

  1. I think sheet names should be printed on standart error, maybe another switch for end-of-sheet marker would by usefull
  2. i would go for separate files with patterns, if patterns are not privided (or ambiguous) it would just postfix basename with sheet index
  3. sheet name should be optional for formulae , if sheet name is not specified it will try to apply formulae for all sheets (usefull for documents where every sheet has the same structure)
Those are the questions why i didn't prepare pull request 1. I think sheet names should be printed on standart error, maybe another switch for end-of-sheet marker would by usefull 2. i would go for separate files with patterns, if patterns are not privided (or ambiguous) it would just postfix basename with sheet index 3. sheet name should be optional for formulae , if sheet name is not specified it will try to apply formulae for all sheets (usefull for documents where every sheet has the same structure)
SheetJSDev commented 2017-06-20 14:10:36 +00:00 (Migrated from github.com)

@pmelisko ok lets stick with the following basic behavior for the purposes of a PR, then we can play around with it and see what makes the most sense:

  1. for the --all-sheets mode, at the beginning of each sheet in the output, print a line like
# <sheet index> <sheet name>
# 0 Sheet1
  1. ignore the pattern for now, just generate files following the scheme <outputname>.<sheetindex> e.g. foo.sylk.0

  2. leave formulae as it currently stands

@pmelisko ok lets stick with the following basic behavior for the purposes of a PR, then we can play around with it and see what makes the most sense: 1) for the --all-sheets mode, at the beginning of each sheet in the output, print a line like ``` # <sheet index> <sheet name> # 0 Sheet1 ``` 2) ignore the pattern for now, just generate files following the scheme `<outputname>.<sheetindex>` e.g. `foo.sylk.0` 3) leave formulae as it currently stands
pmelisko commented 2017-06-20 21:30:53 +00:00 (Migrated from github.com)

Yes, for this case it should be enough.

Yes, for this case it should be enough.
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sheetjs/sheetjs#701
No description provided.