Forum > Beginners
program import CSV & perform calculation
Polly:
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
BigChimp:
You don't need to use csv files - you can use fpspreadsheet which supports .xls files, as well as .xlsx and .ods files:
http://wiki.lazarus.freepascal.org/FPSpreadsheet
See the demo programs and documentation that come with it...
If you do want to use csv files, I recommend using csvdocument:
http://wiki.lazarus.freepascal.org/CsvDocument
Polly:
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.
Mike.Cornflake:
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.
BigChimp:
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
http://wiki.freepascal.org/CSV
Navigation
[0] Message Index
[#] Next page