Module: SysMODB::SpreadsheetExtractor
- Defined in:
- lib/simple-spreadsheet-extractor.rb
Constant Summary collapse
- JAR_VERSION =
"0.9"
- DEFAULT_PATH =
File.dirname(__FILE__) + "/../jars/simple-spreadsheet-extractor-#{JAR_VERSION}.jar"
Instance Method Summary collapse
- #spreadsheet_extractor_command(format = "xml", sheet = nil, trim = false) ⇒ Object
- #spreadsheet_to_csv(spreadsheet_data, sheet = 1, trim = false) ⇒ Object
- #spreadsheet_to_xml(spreadsheet_data) ⇒ Object
Instance Method Details
#spreadsheet_extractor_command(format = "xml", sheet = nil, trim = false) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/simple-spreadsheet-extractor.rb', line 32 def spreadsheet_extractor_command format="xml",sheet=nil,trim=false command = "java -jar #{(defined? SPREADSHEET_EXTRACTOR_JAR_PATH) ? SPREADSHEET_EXTRACTOR_JAR_PATH : DEFAULT_PATH}" command += " -o #{format}" command += " -s #{sheet}" if sheet command += " -t" if trim command end |
#spreadsheet_to_csv(spreadsheet_data, sheet = 1, trim = false) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/simple-spreadsheet-extractor.rb', line 22 def spreadsheet_to_csv spreadsheet_data,sheet=1,trim=false if is_windows? raise Exception.new("Windows is not currently supported") else read_with_open4 spreadsheet_data,"csv",sheet,trim end end |
#spreadsheet_to_xml(spreadsheet_data) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/simple-spreadsheet-extractor.rb', line 14 def spreadsheet_to_xml spreadsheet_data if is_windows? raise Exception.new("Windows is not currently supported") else read_with_open4 spreadsheet_data,"xml" end end |