Latest 0.4.0
License Apache 2.0
Platforms watchos 2.0, tvos 9.0, ios 9.0, osx 10.11
Dependencies ZIPFoundation, XMLCoder

Excel spreadsheet (XLSX) format support in pure Swift

CI Status


To run the example project, clone the repo, and run pod install from the
Example directory first.

Model types in CoreXLSX directly map internal structure of XLSX format with
more sensible naming applied to a few attributes. The API is pretty simple:

import CoreXLSX

guard let file = XLSXFile(filepath: "./categories.xlsx") else {
  fatalError("XLSX file corrupted or does not exist")

for path in try file.parseWorksheetPaths() {
  let ws = try file.parseWorksheet(at: path)
  for row in ?? [] {
    for c in row.cells {

This prints every cell from every worksheet in the given XLSX file. Please refer
to the Worksheet

for more atttributes you might need to read from a parsed file.

Reporting compatibility issues

If you stumble upon a file that can’t be parsed, please file an
posting the exact error
message. Thanks to use of standard Swift Codable protocol, detailed errors are
generated listing a missing attribute, so it can be easily added to the model
enabling broader format support. Attaching a file that can’t be parsed would
also greatly help in diagnosing issues. If these files contain any sensitive
data, we suggest obfuscating or generating fake data with same tools that
generated original files, assuming the issue can still be reproduced this way.

If the whole file can’t be attached, try passing a sufficiently large value
(between 10 and 20 usually works well) to errorContextLength argument of
XLSXFile initializer. This will bundle the failing XML snippet with the debug
description of thrown errors. Please also attach that full debug description if
possible when reporting issues.

How does it work?

Since every XLSX file is a zip archive of XML files, CoreXLSX uses
XMLCoder library and standard
Codable protocols to map XML nodes and atrributes into plain Swift structs.
ZIPFoundation is used for
in-memory decompression of zip archives. A detailed description is available


  • Xcode 10
  • Swift 4.2
  • iOS 9.0 / watchOS 2.0 / tvOS 9.0 / macOS 10.11 or later


Swift Package Manager

Swift Package Manager is a tool for
managing the distribution of Swift code. It’s integrated with the Swift build
system to automate the process of downloading, compiling, and linking

Once you have your Swift package set up, adding CoreXLSX as a dependency is as
easy as adding it to the dependencies value of your Package.swift.

dependencies: [
  .package(url: "",
           .upToNextMajor(from: "0.4.0"))


CoreXLSX is available through CocoaPods. To install
it, simply add pod 'CoreXLSX', '~> 0.4.0' to your Podfile like shown here:

source ''
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target '<Your Target Name>' do
  pod 'CoreXLSX', '~> 0.4.0'


Carthage is a dependency manager that
builds your dependencies and provides you with binary frameworks.

Carthage can be installed with Homebrew using the following

$ brew update
$ brew install carthage

Inside of your Cartfile, add GitHub path to CoreXLSX master branch
(Carthage support is not available in a stable release yet):

github "MaxDesiatov/CoreXLSX" "master"

Then, run the following command to build the framework:

$ carthage update

Drag the built frameworks (including the subdependencies XMLCoder and
ZIPFoundation into your Xcode project.


This project adheres to the Contributor Covenant Code of
By participating, you are expected to uphold this code. Please report
unacceptable behavior to [email protected]


Max Desiatov, Matvii


CoreXLSX is available under the Apache 2.0 license. See the
for more info.

Latest podspec

    "name": "CoreXLSX",
    "version": "0.4.0",
    "summary": "Excel spreadsheet (XLSX) format support in pure Swift",
    "swift_version": "4.2",
    "description": "Excel spreadsheet (XLSX) format support in pure Swift.",
    "homepage": "",
    "license": {
        "type": "Apache 2.0",
        "file": ""
    "authors": {
        "Max Desiatov": "[email protected]"
    "source": {
        "git": "",
        "tag": "0.4.0"
    "social_media_url": "",
    "platforms": {
        "watchos": "2.0",
        "tvos": "9.0",
        "ios": "9.0",
        "osx": "10.11"
    "source_files": "Sources/CoreXLSX/**/*.swift",
    "dependencies": {
        "ZIPFoundation": [
            "~> 0.9.8"
        "XMLCoder": [
            "~> 0.3.1"

Pin It on Pinterest

Share This