Monday, June 19, 2017

RubyXL Gem

https://github.com/weshatheleopard/rubyXL

def self.GetValueFromId(key, sheet, excelfile)
  if (@@WORKSHEETS_ID.eql? nil)
    @@WORKSHEETS_ID = Hash.new
  end
  workbook = nil  if (@@WORKSHEETS_ID.has_key? sheet+excelfile)
    workbook = @@WORKSHEETS_ID.fetch(sheet+excelfile)
  else    workbook = RubyXL::Parser.parse(excelfile)
    @@WORKSHEETS_ID.store(sheet+excelfile, workbook)
  end  worksheet = workbook[sheet]
  first_row = 0  worksheet.each do |row|
    break if row[0].nil?
    strTempValue = worksheet.sheet_data[first_row][0].value
    if strTempValue == key      strDataValue = worksheet.sheet_data[first_row][1].value
      return strDataValue    end    first_row +=1  endend

No comments:

Post a Comment

CTS Outlook Configuration

You can configure outlook using the below settings. 1) Open Control panel and select Mail 2) Select show profile now 3) Select A...