Ruby 的超快Excel Writer
…See more examples
This repository and gem contain sources of libxlsxwriter
# Gemfile
gem 'fast_excel'Or
gem install fast_excelworkbook = FastExcel.open # creates tmp file
# ...
send_data(workbook.read_string, filename: "table.xlsx") # read tmp file and delete itAlso can use workbook.remove_tmp_folder to delete tmp file manually
Constant memory mode: saves each row to disk, good for really big files but can not change previous lines that already saved
workbook = FastExcel.open(constant_memory: true)Save to file
workbook = FastExcel.open("my_dinner.xlsx")FastExcel will automatically detect data type and one of write_number or write_datetime or write_formula or write_string or write_url
…Full libxlsxwriter documentation: http://libxlsxwriter.github.io/
Generated rdoc: rubydoc.info/github/Paxa/fast_excel
1000 rows:
Comparison:
FastExcel: 31.7 i/s
Axlsx: 8.0 i/s - 3.98x slower
write_xlsx: 6.9 i/s - 4.62x slower20000 rows:
Comparison:
FastExcel: 1.4 i/s
Axlsx: 0.4 i/s - 3.46x slower
write_xlsx: 0.1 i/s - 17.04x slowerMax memory usage, generating 100k rows:
FastExcel - 20 MB
Axlsx - 60 MB
write_xlsx - 100 MB暂无开放 Issues,或尚未同步最近议题。