Loading Only Certain Columns of a CSV File lazarus / 16-Databases ---------------------------------------------------------------------- Jade · 2017-08-17 14:51 I am New to Lazarus and I have figured out how to load my CSV file with the SdfDataSet but I can not figure out how to display only certian parts of the CSV file. I only want to read in Col1, Col3, and Col34 of my file into my Grid. I have tried with a DataBaseGrid and a StringGrid. The DataGrid I have gotten to read just the first column but the other ones i can not figure out. Any help would be appreciated. ---------------------------------------------------------------------- Almir.Bispo · 2017-08-17 17:15 Hi ! I'm Lazarus and csv expert. You can do like this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure load(csvf,csvd:string);var s,d,res:tstringlist;       i:integer;begin s:=tstringlist.create;d:=tstringlist.create;res:=tstringlist.create;d. delimiter:=char(';'); //define delimiter used on csvs.loadfromfile(csvf);//file (csv table) loadedfor i:= 0 to s.count-1 dobegin d.delimitedtext:=s.strings[i]; //each row of file (table)res.add(d.strings[0]);//define wich column by index number "zero" is the first columnend;res.savetofile(csvd); res.free;s.free;d.free; end;//how to u se//load('c:\origenal.csv','c:\destin.csv');//sdf.active:=false;//sdf. filename:='c:\destin.csv';//sdf.active:=true;  But if do you want to work with csv like a true Database System,I guess you know the NoSQL CSV Comp DB. The solution is like this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i var CQL:Stringlist;      Column:integer;begin CQL:=Tstringlist.create;//what column to list?Column:= 0;//the first colmun//CQL CommandCQL.add('{csv_table;@listar;0;0;0;0;query='+ inttostr(Column) +';destino=0}'); //save to imput os database systemCQL.savetofile(application.location+'inpout_comp.exe');//execute the csv parser database systemshellexecute(handle,pchar('open'),pchar( application.location+'CSV_PARSER.exe'),nil,nil,0);//wait execution//it depend on SO latencywhile not fileexiste('lock.inf') do begin {do nothing} end;while  fileexiste('lock.inf') do begin {do nothing} end;SDF.active:=false;SDF.filename:='csv_table.que'; //result tableSDF.Active:=true;end; //The cql code is like: Code: Javascript  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {    path\csv_table;    @listar;    0;    0;    0;    0;    query=0;//define the Column here    destino=0} There are exemple with Lazarus and NoSQL http://adltecnologia.blogspot.com.br ---------------------------------------------------------------------- Jade · 2017-09-06 16:24 thank you I actually finally got it to read i had the delimiter set to ; and my CSV file was separated by ,. But any help on my new question i just posted would be appreciated.