1. Products
  2.   Spreadsheet
  3.   Swift
  4.   CoreXLSX

Open Source Swift Library for Microsoft® Excel Spreadsheets

Open Source Swift Library that allows Developers to Parse and Get data from Microsoft Excel file formats (XLSX, XLSM, XLSB) .NET Library.

What is CoreXLSX ?

CoreXLSX is a very useful open source Swift library that allows software developers to open, read, parse, and manipulate Microsoft Excel files in an efficient and straightforward way. The library is based on the XML format used by Microsoft Excel, making it easy to integrate with other Swift projects. The library supports reading and viewing Excel files in numerous file formats, Such as XLSX, XLSM, XLSB, and many more. The library is open-source, meaning that it is freely available for any use and can be modified to suit a particular need of any organization or individual.

The open source CoreXLSX library is designed to be very fast and efficient, helping software developers to handle large Excel files without any performance issues inside their own Swift applications. There are several essential features part of the library, such as Loading existing Excel files, parsing large files with ease, strings sharing between multiple worksheets, reading particular data from an Excel file, printing raw cell data, the exact position of a cell, getting empty cell information, finding a cell by a cell reference, parse style information and many more.

CoreXLSX can be used to extract data from Excel files for visualization in tools like Tableau or Power BI. Overall, Open source CoreXLSX library is an excellent choice for working with Excel files in Swift projects. It provides a wide range of features and benefits, making it easy to handle Excel files efficiently and effectively inside Swift applications. If you need to work with Excel files in your Swift projects, CoreXLSX is definitely worth considering.

Previous Next

Getting Started with CoreXLSX

The recommend way to install CoreXLSX is using CocoaPods. Please use the following command for a smooth installation.

Install CoreXLSX via CocoaPods

 pod 'CoreXLSX', '~> 0.14.1'

pod install

You can download it directly from GitHub.

Reading Data Excel XLSX File via Swift API

The open source CoreXLSX library allows Swift developers to open an existing Excel XLSX document, read and get data from it using Swift commands. To get data from an Excel file, first you need to load the file and then can access the individual worksheets in the file using the sheet(named:) method. After accessing the sheet you can iterate over its rows and columns to read the cell values. The following example shows how to read the first worksheet in the Excel file at the specified path and prints out the contents of each cell in the worksheet.

How to Read First Worksheet of Excel File via Swift API?

import CoreXLSX

guard let file = XLSXFile(filepath: "path/to/file.xlsx") else {
    fatalError("XLSX file not found")

do {
    let sheet = try file.parseWorksheet(at: 0)
    for row in sheet.data?.rows ?? [] {
        for cell in row.cells {
} catch {

Search & Find a Cell using Swift API

The open source CoreXLSX library has provided a very useful feature allowing software developers to search out a worksheet’s cell data by using a cell reference inside their Swift application. The library has provided the ‘worksheet.cells’ property allowing developers to access the cells in the worksheet. Then, use the ‘at’ method to get the cell with the specified reference. The following example demonstrates how to access particular cells in the worksheet using Swift code.

How to Access Particular Cells in a Worksheet using Swift?

import CoreXLSX

# Load Excel File 

guard let file = XLSXFile(filepath: "/path/to/your/file.xlsx") else {
    fatalError("XLSX file at path not found")

# Access the worksheet that contains the cell

guard let worksheet = try file.parseWorksheet(at: "/xl/worksheets/sheet1.xml") else {
    fatalError("Worksheet not found")

# access the cells in the worksheet
guard let cell = worksheet.cells[at: "B3"] else {
    fatalError("Cell not found")

# Display Cell Value


Parse Style Information of XLSX File via Swift API

The open source CoreXLSX library has included a very useful feature for parsing style information of XLSX file since version 0.5.0. Software developers can use the new parseStyles() function to parse style information from the archive inside their Swift application. The library allows developers to fetching a list of fonts used, getting formatting for a given cell, get fill, and border information and so on. The following code shows to get list of fonts used and formatting for a given cell using Swift commands.

How Fetches a List of Fonts Used via Swift Commands?

let styles = try file.parseStyles()
let fonts = styles.fonts?.items.compactMap { $0.name?.value }

//get formatting for a given cell

let styles = try file.parseStyles()
let format = worksheet.data?.rows.first?.cells.first?.format(in: styles)
let font = worksheet.data?.rows.first?.cells.first?.font(in: styles)