๐ŸŒ
Baeldung
baeldung.com โ€บ home โ€บ kotlin โ€บ kotlin io โ€บ read and write to excel with kotlin
Read and Write to Excel With Kotlin | Baeldung on Kotlin
March 26, 2025 - Letโ€™s first have a look at how to handle an Excel file. First of all, Kotlin does not provide out-of-the-box handling of the Excel format. For that purpose, weโ€™ll use the Apache POI libraries.
๐ŸŒ
GitHub
github.com โ€บ evanrupert โ€บ ExcelKt
GitHub - evanrupert/ExcelKt: Kotlin Wrapper over the Apache POI Excel Library that enables creating xlsx files with kotlin builders ยท GitHub
An idiomatic Kotlin wrapper over the Apache POI Excel library for easily generating Excel xlsx files.
Starred by 115 users
Forked by 14 users
Languages ย  Kotlin
๐ŸŒ
Java in Excel
exceljava.com โ€บ docs โ€บ tutorials โ€บ kotlin.html
Creating a Kotlin Excel Add-In - Java in Excel
This tutorial shows how Jinx can be used to write an Excel Add-In exposing user defined functions to Excel written in Kotlin.
๐ŸŒ
MESCIUS
developer.mescius.com โ€บ blogs โ€บ how-to-generate-excel-files-with-kotlin
How to Generate Excel Files with Kotlin | Document Solutions
July 9, 2019 - In addition, you can import existing Excel templates, add data and save the spreadsheets back. You can also use Document Solutions for Excel together with Spread.Sheets, another Spread product that is included in SpreadJS. Being a Java API, DsExcel is fully compatible with Kotlin.
๐ŸŒ
GitHub
github.com โ€บ 4sh โ€บ retable
GitHub - 4sh/retable: Kotlin library to work with tabular data files (csv, excel, open document)
File(pathTo("simple_data.xlsx")).inputStream().use { val hello = Retable.excel().read(it) // read as excel with default settings .records // access the records sequence .map { it["first_name"] + " " + it["last_name"] } // access data by column name (headers in file) .first() // sequence is consumed only on call, so getting first record in a large file is fast println(hello) // prints `Xavier Hanin` }
Author ย  4sh
๐ŸŒ
Chercher
chercher.tech โ€บ null โ€บ null โ€บ read & write excel in kotlin | apache poi
Read & Write Excel in Kotlin | Apache POI
August 29, 2018 - Kotlin : Apache POI helps Kotlin related technologies to read and write Excel files on different platforms, Using apache poi we can do read and write operation of both xls and xlsx file formats.
๐ŸŒ
Developer Soapbox
developersoapbox.com โ€บ basic-read-and-write-excel-using-kotlin
Basic Read and Write Excel Using Kotlin - Developer Soapbox
December 2, 2019 - This post is a very simple example of reading and writing to Excel using Kotlin. Thanks to its Java interoperability, we can utilize theโ€ฆ
๐ŸŒ
GitHub
github.com โ€บ peterbecker โ€บ xls-utils
GitHub - peterbecker/xls-utils: Kotlin utilities for dealing with Excel files
kotlin-xls - a wrapper around POI to make handling Excel files easier, also includes code to compare Excel workbooks, aimed primarily at unit testing
Author ย  peterbecker
๐ŸŒ
DataFrame Help
kotlin.github.io โ€บ dataframe โ€บ excel.html
Excel | DataFrame
Read from and write to Excel files in `.xls` or `.xlsx` formats with Kotlin DataFrame for seamless spreadsheet integration.
Find elsewhere
๐ŸŒ
Kotlin Discussions
discuss.kotlinlang.org โ€บ support
Reading from Excel file - Support - Kotlin Discussions
May 12, 2022 - I am going through my first experience writing an app using Kotlin and Android Studio. Whereas most things worked well or I was able to troubleshoot them (including writing an Excel file) I am not stuck for more than one day on trying to read data from an Excel file.
๐ŸŒ
DataFrame Help
kotlin.github.io โ€บ dataframe โ€บ read.html
Read | DataFrame
May 27, 2026 - It's included by default if you have org.jetbrains.kotlinx:dataframe:1.0.0-Beta5 already. To read an Excel spreadsheet, use the .readExcel() function. Excel spreadsheets can be read from a file or a URL.
๐ŸŒ
Aspose.Cells
docs.aspose.com โ€บ cells โ€บ java โ€บ read-and-write-to-excel-with-kotlin
Read and Write to Excel With Kotlin|Documentation
Learn to read, write, and format Excel files in Kotlin using Aspose.Cells for Java. Includes code examples for formulas and formatting.
๐ŸŒ
YouTube
youtube.com โ€บ watch
Basic Read and Write to Excel / LibreOffice Using Kotlin - YouTube
Basic Read and Write to Excel / LibreOffice Using Kotlin Apache POI Project Page - https://poi.apache.org/DeveloperSoapbox.com blog article about this tutori...
Published ย  February 5, 2018
Top answer
1 of 1
2

To Read XLSX-Typ file Please Check below solution I am using apace poi to read file

build.gradle

dependencies {
implementation 'org.apache.poi:poi:5.2.2'
implementation 'org.apache.poi:poi-ooxml:5.2.2'
}

Create Intent for File Selection:

Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("application/vnd.ms-excel");
startActivityForResult(intent, FILE_SELECT_CODE);

Handle File Selection Result:

 @Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == FILE_SELECT_CODE && resultCode == RESULT_OK) {
        Uri uri = data.getData();
        readExcelFile(uri);
    }
}

Read Excel File from URI:

private void readExcelFile(Uri uri) {
    try {
        InputStream inputStream = getContentResolver().openInputStream(uri);
        Workbook workbook = WorkbookFactory.create(inputStream);
        Sheet sheet = workbook.getSheetAt(0); // Assuming you want the first sheet

        // Iterate through rows and cells
        Iterator<Row> rowIterator = sheet.iterator();
        while (rowIterator.hasNext()) {
            Row row = rowIterator.next();
            Iterator<Cell> cellIterator = row.cellIterator();
            while (cellIterator.hasNext()) {
                Cell cell = cellIterator.next();
                switch (cell.getCellType()) {
                    case STRING:
                        String cellValue = cell.getStringCellValue();
                        // Do something with the string value
                        break;
                    case NUMERIC:
                        double numericCellValue = cell.getNumericCellValue();
                        // Do something with the numeric value
                        break;
                    // Handle other cell types as needed
                }
            }
        }
        workbook.close();
    } catch (IOException | InvalidFormatException e) {
        e.printStackTrace();
    }
}

I hope this work for you

๐ŸŒ
Reddit
reddit.com โ€บ r/kotlin โ€บ write excel add-ins in kotlin
r/Kotlin on Reddit: Write Excel Add-Ins in Kotlin
March 14, 2018 - Discussion about Kotlin, a statically typed programming language for the JVM, Android, JavaScript, and native. ... It works by embedding the JVM in Excel and exposing annotated Kotlin (or Java, Scala etc) functions to Excel as UDFs.
๐ŸŒ
DataFrame Help
kotlin.github.io โ€บ dataframe โ€บ write.html
Write | DataFrame
// Create a new Excel workbook with a single sheet called "allPersons", replacing the file if it already exists -> Current sheets: allPersons df.writeExcel(file, sheetName = "allPersons") // Add a new sheet to the previous file without replacing it, by setting keepFile = true -> Current sheets: allPersons, happyPersons df.filter { person -> person.isHappy }.remove("isHappy") .writeExcel(file, sheetName = "happyPersons", keepFile = true) // Add a new sheet to the previous file without replacing it, by setting keepFile = true -> Current sheets: allPersons, happyPersons, unhappyPersons df.filter { person -> !person.isHappy }.remove("isHappy") .writeExcel(file, sheetName = "unhappyPersons", keepFile = true)
๐ŸŒ
GitHub
github.com โ€บ aPureBase โ€บ ExcelDSL
GitHub - aPureBase/ExcelDSL: An easy to use Kotlin DSL to build Excel documents
An easy to use Kotlin DSL to build Excel documents - aPureBase/ExcelDSL
Author ย  aPureBase