M. Edward (Ed) Borasky
5/28/2007 9:31:00 PM
Quoting Crep Cat <nospam@[127.0.0.1]>:
> I am trying to decide on a language to learn - and would be grateful for
> help.
> My reasons for wanting to learn programming are firstly to have fun
> and secondly to learn more about how computers work.
In that case, I'd recommend either "Everyday Scripting With Ruby" or "Learn To
Program". Both are available as either paper, PDF or combo packs from the
Pragmatic Programmers. Judging by your example below, I'd recommend "Everyday
Scripting With Ruby" first.
>
> I have thought of one thing I would like to write - and wonder if Ruby
> (or perhaps Python?) would be suitable.
Ruby is suitable. I'm guessing Python and Perl are as well, although I haven't
used them for this sort of thing.
>
> I would like to export a spreadsheet column to a file;
> read that file into Ruby as an array;
> mess about with that array;
> write the new array out as a file;
> import that file into a spreadsheet.
>
> I can't understand the documentation about file handling.
> Ruby documentation starts off very user friendly,
> but, by the time it gets to file handling, has become extremely
> esoteric!
>
> Anyway, would Ruby be a good language for that task?
> Would any other language be more suitable?
> Could I get newbie help on file handling here?
> Is there a really good introductory book which deals simply with file
> handling?
Here's what I recommend:
1. I'm assuming that "spreadsheet" means Excel, and that you're on Windows. If
that's not correct, please post otherwise.
2. Download the One-Click Ruby Installer for Windows and install it on your
machine. If you're in a corporate setting behind a firewall, you may need to
have your IT people help you with "gem" updates when you get to that point, but
since you're a beginner, you probably won't be doing that just yet.
3. There is a library in the Windows versions of Ruby that talks *directly* to
spreadsheets using the Windows OLE API. There's no reason to mess with
intermediate files when you can just talk directly to the spreadsheet in Ruby.
4. I think the One-Click Installer comes with a copy of the free version of the
Pickaxe Book ("Programming Ruby"). And I also think that the Windows OLE API is
documented in that version. So that's where I would start.
>
>
>