Forum > Beginners

program import CSV & perform calculation

(1/2) > >>

Hi, I am new to programming and would like to turn my excel sheets with macros into their own executables. By re writing them in Lazarus.

To get  started I was hoping someone would be able to show me some example code of a user form with a menu bar that can import , edit and save a csv file into memory and perform calculations in the background. For example import 100 rows of data in colums 1& 2 then for every row add columns 1+2 and store the answer.

Many thanks in advance.

Lazarus  running on windows. 8 - 64 bit

You don't need to use csv files - you can use fpspreadsheet which supports .xls files, as well as .xlsx and .ods files:

See the demo programs and documentation that come with it...

If you do want to use csv files, I recommend using csvdocument:

Hi thanks for the reply. I will take a look at those links.

I would prefer to use a csv but xls can work just as well.

I suspect FPSpreadsheet can also handle CSV, but there is another approach as well.  TSDFDataset handles CSV well, giving you access to the DB controls for display/navigation.

No, fpspreadsheet cannot handle CSV, sorry.

Also TSDFDataset may happen to work for your CSVs but it is in no way a CSV file format parser; see


[0] Message Index

[#] Next page

Go to full version