forked from seamusabshere/xlsx_writer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfoo.rb
executable file
·36 lines (29 loc) · 1017 Bytes
/
foo.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env ruby
require 'bundler/setup'
if ::Bundler.definition.specs['debugger'].first
require 'debugger'
elsif ::Bundler.definition.specs['ruby-debug'].first
require 'ruby-debug'
end
require 'xlsx_writer'
@doc = XlsxWriter::Document.new
# @sheet1 = @doc.add_sheet("Sheet1")
# @sheet1.add_row(['a', 'a'])
# @sheet1.add_row(['a', { :value => 'a', :faded => true, :type => :String }])
# @sheet1.add_row(['a', 'a'])
# # @sheet1.add_row(['foo', 'bar'])
# @sheet1.add_autofilter 'A1:B1'
@sheet2 = @doc.add_sheet("Sheet2")
@sheet2.add_row(['a', 'a'])
@sheet2.add_row(['false1', false])
@sheet2.add_row(['false2', {:value => false, :type => :Boolean}])
@sheet2.add_row(['false3', 'faLse'])
@sheet2.add_row(['true1', true])
@sheet2.add_row(['true2', {:value => true, :type => :Boolean}])
@sheet2.add_row(['true3', 'trUe'])
# @sheet2.add_row(['hello', 'world'])
# @sheet2.add_row(['yo', 'there'])
# @sheet2.add_row(['foo', 'bar'])
@sheet2.add_autofilter 'A1:B1'
FileUtils.mv @doc.path, 'foo.xlsx'
@doc.cleanup