Socket
Book a DemoInstallSign in
Socket

csv-utils

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

csv-utils

0.3.25
bundlerRubygems
Version published
Maintainers
1
Created
Source

CSV Utils

A Ruby library providing a comprehensive set of utilities for manipulating and processing CSV files. This library offers a robust set of tools for comparing, transforming, sorting, and managing CSV data efficiently.

Features

  • CSV Comparison: Compare two CSV files and identify differences (creates, updates, and deletes)
  • CSV Transformation: Transform CSV data with customizable rules
  • CSV Sorting: Sort CSV files based on specified columns
  • CSV Reporting: Generate reports from CSV data
  • CSV Iteration: Efficient iteration over CSV files
  • CSV Extension: Extend CSV files with additional data
  • CSV Wrapper: Convenient wrapper for CSV operations

Installation

Add this line to your application's Gemfile:

gem 'csv-utils'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install csv-utils

Usage

Comparing CSV Files

require 'csv_utils'

comparator = CSVUtils::CSVCompare.new('primary.csv', ['updated_at']) do |src, dest|
  src['id'] <=> dest['id']
end

comparator.compare('secondary.csv') do |action, record|
  case action
  when :create
    puts "Create: #{record}"
  when :update
    puts "Update: #{record}"
  when :delete
    puts "Delete: #{record}"
  end
end

Sorting CSV Files

sorter = CSVUtils::CSVSort.new('input.csv')
sorter.sort('output.csv', ['id', 'name'])

Transforming CSV Data

transformer = CSVUtils::CSVTransformer.new('input.csv')
transformer.transform('output.csv') do |row|
  # Transform row data
  row['new_column'] = row['old_column'].upcase
  row
end

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/yourusername/csv-utils.

License

The gem is available as open source under the terms of the MIT License.

FAQs

Package last updated on 03 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.