creek icon indicating copy to clipboard operation
creek copied to clipboard

feat: add support for parsing general-format numbers as decimals

Open fabianskier opened this issue 4 months ago • 0 comments

Summary

Add support for automatic parsing of Excel cells with General number format into numeric values (e.g., "1E-3" becomes 0.001). This is controlled via the new parse_general_as_number option in Creek::Book.

Key changes

  • Introduced parse_general_as_number option to Creek::Book and Sheet.
  • Updated the value converter to detect and convert numeric strings in exponential or decimal form using BigDecimal.
  • Preserved backward compatibility: parsing only occurs if the flag is explicitly enabled.
  • Added test coverage with sample files containing large numbers and scientific notation.

Motivation

Without this change, numeric values formatted as General are returned as raw strings, which can lead to incorrect parsing or extra manual conversion. This feature improves developer ergonomics and data consistency.

Related issue

Fixes #96

fabianskier avatar Jun 17 '25 16:06 fabianskier