Sha256: 20eacefc643e4eccc03c033ae775a02a5a1ed92bfbd0b5947fd3403eb381dd0f
Contents?: true
Size: 837 Bytes
Versions: 33
Compression:
Stored size: 837 Bytes
Contents
#!/usr/bin/env ruby # -*- coding: utf-8 -*- require 'write_xlsx' workbook = WriteXLSX.new('defined_name.xlsx') worksheet1 = workbook.add_worksheet worksheet2 = workbook.add_worksheet # Define some global/workbook names. workbook.define_name('Exchange_rate', '=0.96') workbook.define_name('Sales', '=Sheet1!$G$1:$H$10') # Define a local/worksheet name. workbook.define_name('Sheet2!Sales', '=Sheet2!$G$1:$G$10') # Write some text in the file and one of the defined names in a formula. workbook.worksheets.each do |worksheet| worksheet.set_column('A:A', 45) worksheet.write('A1', 'This worksheet contains some defined names.') worksheet.write('A2', 'See Formulas -> Name Manager above.') worksheet.write('A3', 'Example formula in cell B3 ->') worksheet.write('B3', '=Exchange_rate') end workbook.close
Version data entries
33 entries across 33 versions & 1 rubygems