The simplest way to solve this is not to use reflection at all. You can pass the property values directly to the class constructor:

data class Member(val firstName: String, val lastName: String)

fun readCsvFileKotlin() {
    // ...
    for (line in reader) {
        val mbrProperties = line.split(",") 
        memberList.add(Member(mbrProperties[0], mbrProperties[1]))
    }
}

If you want to set properties through reflection, you need to declare them as var rather than val, so that they can be changed after the object is created. Then you can use the set method on the property object to change the property value:

data class Member(var firstName: String? = null, var lastName: String? = null)

fun readCsvFileKotlin() {
    // ...
    val prop = Member::firstName
    for (line in reader) { 
        val mbrProperties = line.split(",") 
        val member = Member()
        prop.set(member, mbrProperties[0])
        memberList.add(member)
    }
}
Answer from yole on Stack Overflow
🌐
Baeldung
baeldung.com › home › kotlin › kotlin io › read and write csv files with kotlin
Read and Write CSV Files With Kotlin | Baeldung on Kotlin
March 19, 2024 - The advantage of the Jackson library is that we can parse CSV rows straight into the data class objects, which are easy to deal with. In this tutorial, we parsed and wrote CSV with various methods. We can use pure Kotlin with only standard libraries to write a parser that won’t change much ...
🌐
DEV Community
dev.to › blackmo18 › kotlin-csv-kotlin-grass-2b8j
Kotlin CSV to Data Class Parser - DEV Community
December 31, 2021 - I tried to google a free jar repository, but ended up suggesting Gradle's source dependency mechanism · Victor Harlan D. Lacson · Victor Harlan D. Lacson · Victor Harlan D. Lacson ... Hi, thanks and I really appreciate the key points you shared. Regarding the custom delimiters, surrounded with quotes, Kotlin-Csv already handles the scenarios.
🌐
GitHub
github.com › doyaaaaaken › kotlin-csv
GitHub - jsoizo/kotlin-csv: Pure Kotlin CSV Reader/Writer · GitHub
February 17, 2022 - For in-memory streams use writer.write(rows, sink) (commonMain kotlinx.io.Sink) or writer.write(rows, stream) (JVM java.io.OutputStream). Both Sequence<List<String>> and List<List<String>> are accepted as the row source. Reader and writer share a CsvDialect value object that holds the four characters defining the CSV format itself: delimiter, quoteChar, escapeChar, lineTerminator.
Starred by 747 users
Forked by 52 users
Languages   Kotlin
🌐
Medium
medium.com › att-israel › jackson-csv-reader-writer-using-kotlin-f37ae771bd6d
Jackson CSV Reader/Writer Using Kotlin | by Ittay Stern | AT&T Israel Tech Blog | Medium
September 16, 2020 - Jackson CSV Reader/Writer Using Kotlin So you’re writing in Kotlin and you want to load your CSV files to a List, or maybe dump your Collection to a CSV file. This is 100% reasonable, given that
🌐
Floern
floern.com
CSV in Kotlin with Casting CSV – floern.com;;
Introduction and deep dive into Casting CSV, my open source Kotlin library to automagically read and write CSV with a one-liner using Kotlin data classes and reflection.
🌐
Stack Abuse
stackabuse.com › reading-and-writing-csv-files-in-kotlin-with-apache-commons
Reading and Writing CSV Files in Kotlin with Apache Commons
February 27, 2023 - In this tutorial, we'll go over how to read and write CSV files in Kotlin, using the Apache Commons library, with examples of reading and writing custom objects.
🌐
SSOJet
ssojet.com › serialize-and-deserialize › serialize-and-deserialize-csv-in-kotlin
Serialize and Deserialize CSV in Kotlin | Serialize and Deserialize Data in Programming Languages
December 13, 2025 - This means you can often use kotlinx-serialization-csv for both reading and writing operations. For instance, consider a List<Product> defined by data class Product(val sku: String, val description: String, val price: Double). You can write this list to a products.csv file using a method similar to this:
Find elsewhere
🌐
ZetCode
zetcode.com › kotlin › csv
Kotlin CSV - read, write CSV files in Kotlin
January 29, 2024 - Kotlin CSV tutorial shows how to read and write CSV files in Kotlin. We use the Opencsv and kotlin-csv libraries.
🌐
MojoAuth
mojoauth.com › serialize-and-deserialize › serialize-and-deserialize-csv-with-ktor
Serialize and Deserialize CSV with Ktor | Serialize & Deserialize Data Across Languages
December 17, 2025 - This guide dives into efficiently serializing Kotlin objects into CSV format and deserializing CSV back into your domain models within Ktor. You'll learn how to integrate libraries like kotlinx.serialization with custom serializers to streamline this process, ensuring your data exchange is ...
🌐
GitHub
gist.github.com › ea035d29c90d24de6290b045796020a1
Example of usage of Kotlin builder to generate a CSV file representing bank transactions · GitHub
Example of usage of Kotlin builder to generate a CSV file representing bank transactions - TransactionBuilder.kt
🌐
DataFrame Help
kotlin.github.io › dataframe › csv-tsv.html
CSV / TSV | DataFrame
Requires the dataframe-csv module, which is included by default in the general dataframe artifact and in %use dataframe for Kotlin Notebook. You can read a DataFrame from a CSV or TSV file (via a file path or URL) using the readCsv() or readTsv() ...
🌐
DataFrame Help
kotlin.github.io › dataframe › read.html
Read | DataFrame
May 27, 2026 - The Kotlin DataFrame library supports CSV, TSV, JSON, XLS and XLSX, and Apache Arrow input formats. The reading from SQL databases is also supported. Read here to know more or explore the example project.
🌐
GitHub
github.com › brudaswen › kotlinx-serialization-csv
GitHub - brudaswen/kotlinx-serialization-csv: Library to easily use Kotlin Serialization to serialize to/from CSV. · GitHub
import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.Serializable import kotlinx.serialization.builtins.ListSerializer import kotlinx.serialization.csv.Csv @Serializable data class Person(val nickname: String, val name: String?, val appearance: Appearance) @Serializable data class Appearance(val gender: Gender?, val age: Int?, val height: Double?)
Starred by 61 users
Forked by 17 users
Languages   Kotlin
🌐
Medium
raphaeldelio.medium.com › how-to-download-a-bigquery-result-into-a-csv-file-using-kotlin-7322506348e
How To Download A BigQuery Result Into a CSV File Using Kotlin | by Raphael De Lio | Medium
February 27, 2024 - And then return the result, which is a TableResult object. Now, we need to create the data class that will hold the information of each row from our result and that will be used to write all the information into our csv file:
🌐
Nick-tomlin
nick-tomlin.com › posts › using-jackson-csv-with-kotlin
Using Jackson CSV with kotlin - Nick Tomlin
April 15, 2020 - import com.fasterxml.jackson.dataformat.csv.CsvMapper import com.fasterxml.jackson.dataformat.csv.CsvSchema import com.fasterxml.jackson.module.kotlin.KotlinModule data class Customer(val id: Int) fun main () { val mapper = CsvMapper() val csv = "id\n1234" val customers = mapper.readerFor(Customer::class.java) .with(CsvSchema.emptySchema().withHeader()) .readValues<Customer>(csv) .readAll() println(customers) } ... com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of `Line_2$Customer` (although at least one Creator exists): cannot deserialize from Object value (no delegate- or property-based Creator) This is because even though we’ve included jackson-module-kotlin, we still need to register it with the CSVMapper in order to properly handle Kotlin classes.
🌐
Kotlin
kotlinlang.org › docs › data-analysis-work-with-data-sources.html
Retrieve data from files | Kotlin Documentation
3 weeks ago - Kotlin DataFrame library enables you to work with both non-structured and structured data. For data transformations, you can use such methods as .add(), .split(), .convert(), and .parse(). Additionally, this toolset enables the retrieval and manipulation of data from various structured file formats, including CSV, JSON, XLS, Parquet, and Apache Arrow.
🌐
GitHub
github.com › mrc-ide › serialization
GitHub - mrc-ide/serialization: A kotlin package for de/serializing large CSV files with variable column headers into fixed types · GitHub
It is constructed from a Sequence<T> of data to be written as rows to a CSV on serialization with column headers derived from the field names of type T. FlexibleDataTable<T> allows you to serialize a sequence of objects of type T, where one ...
Author   mrc-ide