Accessing Excel sheets

Filda filda at senior.cz
Sat Jun 19 11:53:45 UTC 2004


Gunther,

you can also try to do your job using Cincom's VisualWorks Smalltalk
Non-Commercial version. There is a set of parcels called Com-* by which you
can access any ActiveX object through Microsoft's COM interface.

The job is relatively easy since the hierarchy of suitable
COMAutomationControllers including ExcelApplicationController is already
there. Then you can just write your script very similar to VisualBasic Macro
(you can even cheat and simulate things by first record a macro in Excel and
then study the VB code). Or you can of course extend the controller classes
according to your needs.

excel := (Examples.ExcelApplicationController currentClass new) isVisible:
true; yourself.
sheet := excel addWorkbook.
excel setRange: 'A1' to: 'Hello World'.
Transcript cr; show: (excel getRange: 'A1') value.
excel saveActiveWorkbookAs: 'c:\helloWorld.xls'.
excel quit.
sheet release.
excel release.

Happy coding,

Filip Stadnik


----- Original Message ----- 
From: "Guenther Schmidt" <gue.schmidt at web.de>
To: <squeak-dev at lists.squeakfoundation.org>
Sent: Friday, June 18, 2004 11:42 PM
Subject: Re: Accessing Excel sheets


> Hi,
>
> Thank you all.
>
> I had hoped there would be a way to access at least the data from the
> excel sheets directly via squeak without the need to convert the files
> first.
>
> At this time I rather doubt I'd be able to write my own parser for excel
> sheets in squeak ;-). I had hoped somebody already had.
>
> Anyway I reckon converting it into CSVs first is propably the most
> feasable option.
>
> Squeak is very cool and it is far more consistent than anything I've
> tried sofar. (I had a go at Lisp, Scheme and .NET).
>
> Günther
>
>
> Kurt Thams wrote:
> > FYI: You can generate a CSV text file, and if you give the filename
> > extension ".xls", Excel will happily open it upon double-clicking.
> >
> > Of course, if you use CSV you can only put data in the fields, not
formulae,
> > and you can't do any formatting.
> >
> > -- kurt
> >
> >
> >
> >>-----Original Message-----
> >>From: squeak-dev-bounces at lists.squeakfoundation.org
> >>[mailto:squeak-dev-bounces at lists.squeakfoundation.org]On Behalf Of Ken
> >>Causey
> >>Sent: Friday, June 18, 2004 1:49 PM
> >>To: The general-purpose Squeak developers list
> >>Subject: Re: Accessing Excel sheets
> >>
> >>
> >>My first suggestion would be to export them from Excel in a well
> >>understood format like CSV (comma-seperated value).
> >>
> >>Ken
> >>
> >>On Fri, 2004-06-18 at 14:00, Guenther Schmidt wrote:
> >>
> >>>Hi,
> >>>
> >>>I need to develop an application that needs to access MS Excel
> >>
> >>spreadsheets.
> >>
> >>>I am very new to Smalltalk - Squeak and Morphic but I
> >>
> >>nevertheless think
> >>
> >>>that I'll manage to write that app in Squeak, the biggest
> >>
> >>obstacle right
> >>
> >>>know is accessing those spreadsheets, no clue sofar.
> >>>
> >>>Any tip would be truly appreciated,
> >>>
> >>>thank upfront
> >>>
> >>>Günther
> >
> >
> >
> >
>
>
>
>
>




More information about the Squeak-dev mailing list