[fpc-pascal] read cells contents from .xls file

John Lee johnelee0 at gmail.com
Tue Oct 1 21:44:16 CEST 2013


Thanks for all suggestions. IMO fpspread...pas is too complex for & I'd
need to hack thro' thousands of lines - maybe a simple program to read xls
into csv, as in b) below could be added?.

Here, fyi, In looking around I came up with these 2 :

a) googled 'read xls'

http://exceldatareader.codeplex.com/

Unfortunately I don't use c# but the mechanisms for reading spread look
simple in the referenced page ie 1 line!

Guess one could try to use the excel.dll in te reference in fpc & then
access it from fpc

b) using a <10 line vbs program referenced here to create a csv file then
getting the data from that

http://stackoverflow.com/questions/1858195/convert-xls-to-csv-on-command-line

This is the way I'm doing it, running the vbs file from cmd using exec etc,
simple if crude!.

john




On 1 October 2013 12:15, John Lee <johnelee0 at gmail.com> wrote:

> Thanks - as you say (with nice irony) it isn't a simple format, and I
> don't pretend to understand it, indeed it is 'doing my head in'  -  but I
> don't want to write .xls or do charts etc, just read some cells (only in in
> excel 2003, seems to be v11 according to help) - maybe my hope of a few
> lines, with one or two units 'used', isn't possible but there seem to be
> millions of lines here. Is there an example of reading cells from named
> spread that you could point to?
>
> John
>
>
> On 1 October 2013 08:44, Felipe Monteiro de Carvalho <
> felipemonteiro.carvalho at gmail.com> wrote:
>
>> The source code of fpspreadsheet is open ... just copy/paste/modifiy
>> it for your needs:
>>
>>
>> https://sourceforge.net/p/lazarus-ccr/svn/HEAD/tree/components/fpspreadsheet/xlsbiff8.pas#l50
>>
>> But BIFF8 is not a simple format, there is no simple answer to your
>> question. It is encapsulated in a OLE Document storage system to start
>> with, which is something pretty complex.
>>
>> BIFF2 till BIFF5 (Excel 5.0) were simple formats, but that's not the
>> format you are looking for from your question.
>>
>> Felipe
>>
>> On Mon, Sep 30, 2013 at 9:45 PM, John Lee <johnelee0 at gmail.com> wrote:
>> > Thanks - that looks excellent, but the 'uses' list for this, for non
>> lazarus
>> > users, has, I guess, lots of things in it.
>> >
>> > The problem is also that I'm trying to implement this hack in an old
>> version
>> > of pascal, v2.2.2 for which I only have the compiler & basic rtl stuff -
>> > that's why I'd just like some info for a quick hack eg some bullets or
>> some
>> > idea what I need to do eg to read the no or string in eg cell x23 of
>> sheet
>> > jim in fred.xls.
>> >
>> > John
>> >
>> >
>> >
>> >
>> >
>> >
>> > On 30 September 2013 16:38, Felipe Monteiro de Carvalho
>> > <felipemonteiro.carvalho at gmail.com> wrote:
>> >>
>> >> You mean like this library does?
>> http://wiki.freepascal.org/FPSpreadsheet
>> >>
>> >> Felipe Monteiro de Carvalho
>> >>
>> >> On Mon, Sep 30, 2013 at 5:33 PM, John Lee <johnelee0 at gmail.com> wrote:
>> >> > File produced by excel 2003. Can anyone tell me the basic ideas,
>> >> > formats,
>> >> > pitfalls - I'd just like to write a short routine & don't want to
>> fight
>> >> > with
>> >> > the complexities of the lazarus based stuff. Prepared to
>> experiment...
>> >> >
>> >> > TIA John
>> >> >
>> >> >
>> >> >
>> >> > _______________________________________________
>> >> > fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
>> >> > http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>> >>
>> >>
>> >>
>> >> --
>> >> Felipe Monteiro de Carvalho
>> >> _______________________________________________
>> >> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
>> >> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>> >
>> >
>> >
>> > _______________________________________________
>> > fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
>> > http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>>
>>
>>
>> --
>> Felipe Monteiro de Carvalho
>> _______________________________________________
>> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
>> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20131001/9b3c554b/attachment.html>


More information about the fpc-pascal mailing list