No release in over 3 years
Low commit activity in last 3 years
Export your data as various types of spreadsheets. Supports csv and xlsx output.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

SpreadsheetExporter

gem 'spreadsheet_exporter'

Usage

Objects that are exported must respond to as_csv or as_json and return a hash representing column names and values.

CSV or XLSX

Output can be .csv or .xlsx. Choose by using SpreadsheetExporter::CSV or SpreadsheetExporter::XLSX modules. Note that .csv output is actually tab delimited by default so that Excel can open files properly without needing to use its import function. If you need to output that is actually comma-delimited, pass :col_sep => ',' as an option when exporting

Array of ActiveRecord Objects

  SpreadsheetExporter::CSV.from_objects(array_of_objects, options)

  # Humanize header names using klass.human_attribute_name
  SpreadsheetExporter::CSV.from_objects(array_of_objects, :humanize_headers_class => User)

2D Array

  SpreadsheetExporter::CSV.from_spreadsheet([["First Name", "Last Name"], ["Bob", "Hoskins"], ["Roger", "Rabbit"]])