# Excel

> For the complete documentation index, see [llms.txt](https://kotlin.github.io/dataframe/llms.txt).

Kotlin DataFrame supports reading from and writing to Excel files in both `.xls` and `.xlsx` formats.

API reference: [readExcel](https://kotlin.github.io/dataframe/api-docs/dataframe-excel/org.jetbrains.kotlinx.dataframe.io/read-excel.html), [writeExcel](https://kotlin.github.io/dataframe/api-docs/dataframe-excel/org.jetbrains.kotlinx.dataframe.io/write-excel.html), [dataframe-excel module](https://kotlin.github.io/dataframe/api-docs/dataframe-excel/index.html)

Requires the [dataframe-excel module](modules.html#dataframe-excel), which is included by default in the general [dataframe](modules.html#dataframe-general) artifact and in [%use dataframe](setupkotlinnotebook.html#integrate-kotlin-dataframe) for Kotlin Notebook.

> **Warning:**
> When packaging an application as a fat JAR, merge `META-INF/services` resources. Otherwise, reading `.xls` or `.xlsx` files may fail even though all Apache POI dependencies are present. See [Packaging into a fat JAR](Packaging.md).

## Read

You can read a [DataFrame](dataframe.html) from an Excel file (via a file path or URL) using the [readExcel()](read.html#read-from-excel) method:

```KOTLIN
val df = DataFrame.readExcel("example.xlsx")
```

```KOTLIN
val df = DataFrame.readExcel("https://kotlin.github.io/dataframe/resources/example.xlsx")
```

## Write

You can write a [DataFrame](dataframe.html) to an Excel file using the [writeExcel()](write.html#write-to-excel-spreadsheet) method:

```KOTLIN
df.writeExcel("example.xlsx")
```

