require 'win32ole'
require 'watir'
module WriteExcel
def write_data_excel
excel = WIN32OLE::new('excel.Application')
path = File.dirname(__FILE__)
data_source = File.join(path,'548183_add.xls')
workbook = excel.Workbooks.Open(data_source)
worksheet = workbook.Worksheets("excel的sheet页面名字")
worksheet.Select #选择操作excel的某个sheet页面
character=worksheet.Range("a2")['Value']
character=character.split("-")
f=character[0]
b=character[1]
character=f.to_i+"-"+b.to_s
worksheet.Range("a2")['Value'] = character
#关闭文件
workbook.save
#结束对excel的操作
excel.Quit
end
end
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。