# Spreadsheet development

**URL:** <https://www.ruby-forum.com/t/spreadsheet-development/166113>\
**Category:** Ruby\
**Created:** [April 22, 2009, 12:30am UTC](https://www.ruby-forum.com/t/spreadsheet-development/166113 "2009-04-22T00:30:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![amabdelsalam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/958977/32.png) [@amabdelsalam](https://www.ruby-forum.com/u/amabdelsalam)\
**Post date:** [April 22, 2009, 12:30am UTC](https://www.ruby-forum.com/t/spreadsheet-development/166113/1 "2009-04-22T00:30:24Z")

</div>

Hi,…

I’d like to create a Spreadsheet model, where I can access cells like  
the following:

sheet = Spreadsheet.new  
sheet.cells.a1 = ‘Hello’  
sheet.cells.b3 = ‘World’

The problem is in how to define cell names to be accessed in the above  
manner?

Any help?

Thanks

Ahmed

---

<div class="post-metadata">

**Author:** ![amabdelsalam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/958977/32.png) [@amabdelsalam](https://www.ruby-forum.com/u/amabdelsalam)\
**Post date:** [April 22, 2009, 12:37am UTC](https://www.ruby-forum.com/t/spreadsheet-development/166113/2 "2009-04-22T00:37:42Z")

</div>

On Wed, Apr 22, 2009 at 4:00 AM, Ahmed A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> manner?
> 
> Any help?

method\_missing should do it

irb(main):001:0\> class Cells  
irb(main):002:1\> def method\_missing(meth, \*args)  
irb(main):003:2\> print “you tried to access cell #{meth}”  
irb(main):004:2\> end  
irb(main):005:1\> end  
irb(main):006:0\> cells = Cells.new  
irb(main):007:0\> cells.a1  
you tried to access cell a1

martin

---

<div class="post-metadata">

**Author:** ![amabdelsalam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/958977/32.png) [@amabdelsalam](https://www.ruby-forum.com/u/amabdelsalam)\
**Post date:** [April 22, 2009, 2:20pm UTC](https://www.ruby-forum.com/t/spreadsheet-development/166113/3 "2009-04-22T14:20:47Z")

</div>

> Thanks martin for your response. I’ve tried it with ruby and it’s OK.  
> Actually my objective is to run it with JRuby, but the same code is  
> giving error:  
> at (unknown).(unknown)(Unknown Source)  
> at #Class:01x114025.method\_missing(:1)  
> at (unknown).(unknown)(:1)
> 
> Any suggestion?

Upgrade? There were problems with method\_missing in older versions of  
JRuby. I don’t know what version you’re using, but I would suggest  
1.2.

– Mark.

---

<div class="post-metadata">

**Author:** ![amabdelsalam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/958977/32.png) [@amabdelsalam](https://www.ruby-forum.com/u/amabdelsalam)\
**Post date:** [April 22, 2009, 1:36pm UTC](https://www.ruby-forum.com/t/spreadsheet-development/166113/4 "2009-04-22T13:36:34Z")

</div>

Martin DeMello wrote:

> On Wed, Apr 22, 2009 at 4:00 AM, Ahmed A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> wrote:
> 
> > manner?
> > 
> > Any help?
> 
> method\_missing should do it
> 
> irb(main):001:0\> class Cells  
> irb(main):002:1\> def method\_missing(meth, \*args)  
> irb(main):003:2\> print “you tried to access cell #{meth}”  
> irb(main):004:2\> end  
> irb(main):005:1\> end  
> irb(main):006:0\> cells = Cells.new  
> irb(main):007:0\> cells.a1  
> you tried to access cell a1
> 
> martin

Thanks martin for your response. I’ve tried it with ruby and it’s OK.  
Actually my objective is to run it with JRuby, but the same code is  
giving error:  
at (unknown).(unknown)(Unknown Source)  
at #Class:01x114025.method\_missing(:1)  
at (unknown).(unknown)(:1)

Any suggestion?

Regards,…

Ahmed
