[wb_add_data] string_nums option. closes #503 #516
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR provides a
string_nums
option foropenxlsx2
to control if strings that can be expressed as numerics should be written as styled numerics and not as character strings (e.g."1"
as1
).This does not provide on the fly conversions from strings to numerics (which ... would be possible as well; simply avoid writing the style to the cell).This needs some testing (accuracy and speed) and for now I have hidden it with an option. This option knows states 0 (the current default), 1 (write string as number with cell style) and 2 (write string as number). The entire conversion part likely will have an impact on writing time, due to the call to
is_double()
.Update
With the latest push on my Arch Linux desktop I see the following. It is quite fast, though I'm not sure about the effects of setting this style
applyNumberFormat = "1", quotePrefix = "1", numFmtId = "49"
on every character cell, if any cell requires it. That somehow seems like overkill. Setting it only to those cells that need it, slows the example terribly down.