Read sequentially an excel file

Questions and answers on how to use XLSReadWriteII 5.
Post Reply
advantage
Posts: 2
Joined: Mon Nov 27, 2017 4:48 pm

Read sequentially an excel file

Post by advantage »

Hi all.

I need to open a excel file with about 3000 lines and 5 columns , and for each cell do some calculation
and them write them in a database searching previously if cell one does not exist in my db file.

How can I do that ??

Mant thanks.

Regards
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: Read sequentially an excel file

Post by larsa »

Hello

Here is an example:

Code: Select all

  XLS[0].CalcDimensions;

  for r := XLS[0].FirstRow to XLS[0].LastRow do begin
    for c := XLS[0].FirstCol to XLS[0].LastCol do begin
      // Do something with the values.
      case XLS[0].CellType[c,r] of
        xctNone          : ;
        xctBlank         : ;
        xctBoolean       : B := XLS[0].AsBoolean[c,r];
        xctError         : ;
        xctString        : S := XLS[0].AsString[c,r];
        xctFloat         : V := XLS[0].AsFloat[c,r];
        xctFloatFormula  : ;
        xctStringFormula : ;
        xctBooleanFormula: ;
        xctErrorFormula  : ;
      end;
    end;
  end;
Lars Arvidsson, Axolot Data
advantage
Posts: 2
Joined: Mon Nov 27, 2017 4:48 pm

Re: Read sequentially an excel file

Post by advantage »

Thank you so much.

Works perfectly..

Regards
Post Reply