[SOLVED] FPSpreadsheet, read number as string from csv lazarus / 49-FPSpreadsheet ---------------------------------------------------------------------- nomorelogic · 2023-03-27 10:48 hi all I've a CSV where third column contains barcodes 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 'SomeData1','I','                  001234000345','SomeData2''SomeData1','I','                  001234090456','SomeData2''SomeData1','I','                  001234100678','SomeData2'  As you can see, all columns are strings delimited using single quote. Anyway, reading 3rd column using 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 s := UTF8ToString(CsvWorksheet.ReadAsText(CurCell^.Row, CurCell^.Col));  I get: 1234000345, 1234090456 and 1234100678 (the initial 0es are missing) Columns are string, but CurCell^.ContentType = cctNumber. I need initial zeroes as they're part of barcode. Any idea on how I can read this value as string? Thanks nomorelogic ---------------------------------------------------------------------- Bart · 2023-03-27 11:01 As a workaround, if the numbers are of fixed with, you can zero-padd the result? Bart ---------------------------------------------------------------------- nomorelogic · 2023-03-27 11:17 zero-padd the result is a possible workaround anyway I must assume the length as a costant (in this case length = 12) there may be other cases where the length of the field is different if there was a setting to force reading as a string (after all, the field IS delimited as a string) I would prefer it ---------------------------------------------------------------------- wp · 2023-03-27 11:22 Import of csv files into fpspreadsheet is determined by the CSVParams record; there is a field "DetectContentType" which you must set to false in order to disable automatic cell format detection. 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 program test_project; uses  fpspreadsheet, fpstypes, fpscsv;var  book: TsWorkbook;  sheet: TsWorksheet;  r, c: Integer;begin  CSVParams.Delimiter := ',';  CSVParams.DetectContentType := false;  CSVParams.QuoteChar := '''';   book := TsWorkbook.Create;  try    book.ReadFromFile('data.csv', sfCSV);    sheet := book.GetFirstWorksheet;    for r := 0 to sheet.GetLastRowIndex do    for c := 0 to sheet.GetLastcolIndex do        WriteLn('Row ', r, ' Col ', c, ': >', sheet.ReadAsText(r, c), '<');  finally    book.Free;  end;   ReadLn;end. ---------------------------------------------------------------------- nomorelogic · 2023-03-27 15:48 it works! thank you all nomorelogic