Reading from CSV file

I have Ignition Perspecive 8.2.
Could be transform from string to dataset with function system.dataset.fromCSV() the latest n rows(from end)?

data_string = system.file.readFileAsString(filepath)
data1= "#NAMES"+"\n"+"timestamp,bazen" +"\n"+"#TYPES"+"\n"+ "date;D"+ "\n"+"#ROWS;3000"+"\n"+ data_string 
data2 =data1.replace(";",",")
data3 = system.dataset.fromCSV(data2)``

Take a closer look at your version number, since that one doesn't exist and will not exist. (IA announced that they will be skipping over v8.2 to v8.3 late next year or early 2024.)

To your question: consider using a library to read your CSV line by line, keeping the last 20, then converting to dataset at the end.