Introduction to SmarterCSV
mainSmarterCSV is a Ruby gem designed for high-performance and convenient CSV importing and exporting. Unlike Ruby's built-in CSV library which returns arrays of arrays, SmarterCSV returns 'Rails-ready' hashes with symbol keys, automatic numeric conversion, and whitespace stripping. This makes it ideal for direct use with ActiveRecord, insert_all, Sidekiq, or parallel processing workflows.
Key capabilities include:
- High Performance: Uses a C extension to accelerate parsing, hash construction, and value conversion.
- Robustness: Auto-detects row/column separators and handles common issues like BOMs and inconsistent whitespace.
- Batch Processing: Supports memory-efficient chunked processing via
chunk_size. - Data Transformation: Provides built-in support for header remapping, column selection, and custom value converters.