Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: "julia"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
22 changes: 0 additions & 22 deletions .github/workflows/jlpkgbutler-butler-workflow.yml

This file was deleted.

40 changes: 0 additions & 40 deletions .github/workflows/jlpkgbutler-ci-master-workflow.yml

This file was deleted.

36 changes: 0 additions & 36 deletions .github/workflows/jlpkgbutler-ci-pr-workflow.yml

This file was deleted.

23 changes: 0 additions & 23 deletions .github/workflows/jlpkgbutler-codeformat-pr-workflow.yml

This file was deleted.

20 changes: 0 additions & 20 deletions .github/workflows/jlpkgbutler-compathelper-workflow.yml

This file was deleted.

23 changes: 0 additions & 23 deletions .github/workflows/jlpkgbutler-docdeploy-workflow.yml

This file was deleted.

17 changes: 0 additions & 17 deletions .github/workflows/jlpkgbutler-tagbot-workflow.yml

This file was deleted.

17 changes: 17 additions & 0 deletions .github/workflows/juliaci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Julia CI

on:
push: {branches: [main,master]}
pull_request: {types: [opened,synchronize,reopened,ready_for_review,converted_to_draft]}
issue_comment: {types: [created]}
workflow_dispatch: {inputs: {feature: {type: choice, description: What to run, options: [DocDeploy,LintAndTest,TagBot]}}}

jobs:
julia-ci:
uses: julia-testitems/testitem-workflow/.github/workflows/juliaci.yml@v2
with:
include-all-compatible-minor-versions: true
include-rc-versions: true
permissions: write-all
secrets:
codecov_token: ${{ secrets.CODECOV_TOKEN }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
*.jl.mem
Manifest.toml
.vscode
docs/build/
docs/Manifest.toml
test-output*.*
1 change: 0 additions & 1 deletion .jlpkgbutler.toml

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The ExcelFiles.jl package is licensed under the MIT "Expat" License:

> Copyright (c) 2017-2019: David Anthoff.
> Copyright (c) 2017-2026: David Anthoff.
>
>
> Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down
15 changes: 8 additions & 7 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name = "ExcelFiles"

Check notice on line 1 in Project.toml

View workflow job for this annotation

GitHub Actions / julia-ci / lint

environment_errors

Failed to resolve the test environment of package 'ExcelFiles' at /home/runner/work/ExcelFiles.jl/ExcelFiles.jl: Unsatisfiable requirements detected for package ExcelReaders [c04bee98]. Missing-reference checks are degraded in that scope; enable debug logging for the full error.
uuid = "89b67f3b-d1aa-5f6f-9ca4-282e8d98620d"
version = "1.0.1-DEV"

Expand All @@ -10,28 +10,29 @@
IterableTables = "1c8ee90f-4401-5389-894e-7a04a3dc0f4d"
IteratorInterfaceExtensions = "82899510-4779-5014-852e-03e436cf321d"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
PyCall = "438e738f-606a-5dbb-bf0a-cddfbfd45ab0"
TableShowUtils = "5e66a065-1f0a-5976-b372-e0b8c017ca10"
TableTraits = "3783bdb8-4a98-5b6b-af9a-565f29a5fe9c"
TableTraitsUtils = "382cd787-c1b6-5bf2-a167-d5b971a19bda"
XLSX = "fdbf4ff8-1666-58a4-91e7-1b58723a45e0"

[compat]
DataValues = "0.4.11"
ExcelReaders = "0.11"
DataValues = "0.4.11, 0.5, 1"
Dates = "1"
ExcelReaders = "0.13, 1"
FileIO = "1"
IterableTables = "0.8.3, 0.9, 0.10, 0.11, 1"
IteratorInterfaceExtensions = "0.1.1, 1"
PyCall = "1.90"
TableShowUtils = "0.2"
Printf = "1"
TableShowUtils = "0.2, 0.3, 1"
TableTraits = "0.3.1, 0.4, 1"
TableTraitsUtils = "0.3, 0.4, 1"
XLSX = "0.4.1, 0.5, 0.6, 0.7, 0.8, 0.9"
XLSX = "0.12"
julia = "1"

[extras]
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
TestItemRunner = "f8b46487-2199-4994-9208-9a1283c18c0a"

[targets]
test = ["Test", "DataFrames"]
test = ["Test", "DataFrames", "TestItemRunner"]
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
# ExcelFiles

[![Project Status: Active - The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active)
[![Build Status](https://travis-ci.org/queryverse/ExcelFiles.jl.svg?branch=master)](https://travis-ci.org/queryverse/ExcelFiles.jl)
[![Build status](https://ci.appveyor.com/api/projects/status/wfx5avj0s2m0x94w/branch/master?svg=true)](https://ci.appveyor.com/project/queryverse/excelfiles-jl/branch/master)
[![Build Status](https://github.com/queryverse/ExcelFiles.jl/actions/workflows/juliaci.yml/badge.svg?branch=main)](https://github.com/queryverse/ExcelFiles.jl/actions/workflows/juliaci.yml)
[![codecov.io](http://codecov.io/github/queryverse/ExcelFiles.jl/coverage.svg?branch=master)](http://codecov.io/github/queryverse/ExcelFiles.jl?branch=master)

## Overview

This package provides load support for Excel files under the
[FileIO.jl](https://github.com/JuliaIO/FileIO.jl) package.
[FileIO.jl](https://github.com/JuliaIO/FileIO.jl) package. Both modern xlsx
files and legacy xls files can be loaded (the format is detected from the
content of the file); saving is supported for xlsx files.

Note that the central FileIO registry routes Excel files to
[XLSX.jl](https://github.com/JuliaData/XLSX.jl) and does not cover xls files.
Once ExcelFiles is loaded (``using ExcelFiles``), its loader takes priority,
which restores range-based loading (``"Sheet1!A1:C4"``), the lazy iterable
table interface, and support for xls files.

## Installation

Expand Down
2 changes: 1 addition & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"

[compat]
Documenter = "~0.24"
Documenter = "1"
3 changes: 2 additions & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ using Documenter, ExcelFiles

makedocs(modules=[ExcelFiles],
sitename="ExcelFiles.jl",
analytics="UA-132838790-1",
format = Documenter.HTML(analytics = "UA-132838790-1"),
warnonly = [:missing_docs],
pages=[
"Introduction" => "index.md"
])
Expand Down
34 changes: 32 additions & 2 deletions src/ExcelFiles.jl
Original file line number Diff line number Diff line change
@@ -1,12 +1,36 @@
module ExcelFiles


using ExcelReaders, XLSX, IteratorInterfaceExtensions, TableTraits, DataValues

Check warning on line 4 in src/ExcelFiles.jl

View workflow job for this annotation

GitHub Actions / julia-ci / lint

unresolved_import

Failed to resolve `DataValues`. Missing-reference checks are disabled in this scope and all nested scopes.

Check warning on line 4 in src/ExcelFiles.jl

View workflow job for this annotation

GitHub Actions / julia-ci / lint

unresolved_import

Failed to resolve `TableTraits`. Missing-reference checks are disabled in this scope and all nested scopes.

Check warning on line 4 in src/ExcelFiles.jl

View workflow job for this annotation

GitHub Actions / julia-ci / lint

unresolved_import

Failed to resolve `IteratorInterfaceExtensions`. Missing-reference checks are disabled in this scope and all nested scopes.

Check warning on line 4 in src/ExcelFiles.jl

View workflow job for this annotation

GitHub Actions / julia-ci / lint

unresolved_import

Failed to resolve `XLSX`. Missing-reference checks are disabled in this scope and all nested scopes.

Check warning on line 4 in src/ExcelFiles.jl

View workflow job for this annotation

GitHub Actions / julia-ci / lint

unresolved_import

Failed to resolve `ExcelReaders`. Missing-reference checks are disabled in this scope and all nested scopes.
using TableTraitsUtils, FileIO, TableShowUtils, Dates, Printf

Check warning on line 5 in src/ExcelFiles.jl

View workflow job for this annotation

GitHub Actions / julia-ci / lint

unresolved_import

Failed to resolve `Printf`. Missing-reference checks are disabled in this scope and all nested scopes.

Check warning on line 5 in src/ExcelFiles.jl

View workflow job for this annotation

GitHub Actions / julia-ci / lint

unresolved_import

Failed to resolve `Dates`. Missing-reference checks are disabled in this scope and all nested scopes.

Check warning on line 5 in src/ExcelFiles.jl

View workflow job for this annotation

GitHub Actions / julia-ci / lint

unresolved_import

Failed to resolve `TableShowUtils`. Missing-reference checks are disabled in this scope and all nested scopes.

Check warning on line 5 in src/ExcelFiles.jl

View workflow job for this annotation

GitHub Actions / julia-ci / lint

unresolved_import

Failed to resolve `FileIO`. Missing-reference checks are disabled in this scope and all nested scopes.

Check warning on line 5 in src/ExcelFiles.jl

View workflow job for this annotation

GitHub Actions / julia-ci / lint

unresolved_import

Failed to resolve `TableTraitsUtils`. Missing-reference checks are disabled in this scope and all nested scopes.
import IterableTables

export load, save, File, @format_str

function __init__()
# Since FileIO PR #439 (July 2026) the central FileIO registry routes
# format"Excel" to XLSX.jl's own FileIO extension, and no longer covers
# legacy xls files at all. Loading ExcelFiles puts its loader first
# again, and registers a format for xls files. Users who don't load
# ExcelFiles are unaffected.
try
loaders = get!(Vector{FileIO.ActionSource}, FileIO.sym2loader, :Excel)
filter!(x -> x !== ExcelFiles, loaders)
pushfirst!(loaders, ExcelFiles)
savers = get!(Vector{FileIO.ActionSource}, FileIO.sym2saver, :Excel)
filter!(x -> x !== ExcelFiles, savers)
pushfirst!(savers, ExcelFiles)

if !haskey(FileIO.sym2info, :ExcelLegacy)
FileIO.add_format(FileIO.format"ExcelLegacy", (), [".xls"],
[:ExcelFiles => Base.UUID("89b67f3b-d1aa-5f6f-9ca4-282e8d98620d"), FileIO.LOAD])
end
catch err
@warn "ExcelFiles could not register itself with FileIO. Loading Excel files via FileIO.load may not use ExcelFiles." exception = (err, catch_backtrace())
end
return nothing
end

struct ExcelFile
filename::String
range::String
Expand All @@ -21,15 +45,17 @@
TableShowUtils.printHTMLtable(io, getiterator(source))
end

Base.Multimedia.showable(::MIME"text/html", source::ExcelFile) = true

Check notice on line 48 in src/ExcelFiles.jl

View workflow job for this annotation

GitHub Actions / julia-ci / lint

unused_function_argument

An argument is included in a function signature but not used within its body.

function Base.show(io::IO, ::MIME"application/vnd.dataresource+json", source::ExcelFile)
TableShowUtils.printdataresource(io, getiterator(source))
end

Base.Multimedia.showable(::MIME"application/vnd.dataresource+json", source::ExcelFile) = true

Check notice on line 54 in src/ExcelFiles.jl

View workflow job for this annotation

GitHub Actions / julia-ci / lint

unused_function_argument

An argument is included in a function signature but not used within its body.

function fileio_load(f::FileIO.File{FileIO.format"Excel"}, range; keywords...)
const ExcelFileFormat = Union{FileIO.File{FileIO.format"Excel"},FileIO.File{FileIO.format"ExcelLegacy"}}

function fileio_load(f::ExcelFileFormat, range; keywords...)
return ExcelFile(f.filename, range, keywords)
end

Expand All @@ -38,8 +64,12 @@
return XLSX.writetable(f.filename, cols, colnames; sheetname=sheetname)
end

function fileio_save(f::FileIO.File{FileIO.format"ExcelLegacy"}, data; kwargs...)

Check notice on line 67 in src/ExcelFiles.jl

View workflow job for this annotation

GitHub Actions / julia-ci / lint

unused_function_argument

An argument is included in a function signature but not used within its body.

Check notice on line 67 in src/ExcelFiles.jl

View workflow job for this annotation

GitHub Actions / julia-ci / lint

unused_function_argument

An argument is included in a function signature but not used within its body.
error("Writing legacy xls files is not supported. Save to an xlsx file instead.")
end

IteratorInterfaceExtensions.isiterable(x::ExcelFile) = true

Check notice on line 71 in src/ExcelFiles.jl

View workflow job for this annotation

GitHub Actions / julia-ci / lint

unused_function_argument

An argument is included in a function signature but not used within its body.
TableTraits.isiterabletable(x::ExcelFile) = true

Check notice on line 72 in src/ExcelFiles.jl

View workflow job for this annotation

GitHub Actions / julia-ci / lint

unused_function_argument

An argument is included in a function signature but not used within its body.

function gennames(n::Integer)
res = Vector{Symbol}(undef, n)
Expand All @@ -52,7 +82,7 @@
function _readxl(file::ExcelReaders.ExcelFile, sheetname::AbstractString, startrow::Integer, startcol::Integer, endrow::Integer, endcol::Integer; header::Bool=true, colnames::Vector{Symbol}=Symbol[])
data = ExcelReaders.readxl_internal(file, sheetname, startrow, startcol, endrow, endcol)

nrow, ncol = size(data)

Check notice on line 85 in src/ExcelFiles.jl

View workflow job for this annotation

GitHub Actions / julia-ci / lint

unused_binding

Variable has been assigned but not used.

if length(colnames) == 0
if header
Expand Down Expand Up @@ -112,7 +142,7 @@
_readxl(excelfile, sheetname, startrow, startcol, endrow, endcol; file.keywords...)
else
excelfile = openxl(file.filename)
sheet = excelfile.workbook.sheet_by_name(file.range)
sheet = ExcelReaders.sheet_handle(excelfile, file.range)

keywords = filter(i -> !(i[1] in (:header, :colnames)), file.keywords)
startrow, startcol, endrow, endcol = ExcelReaders.convert_args_to_row_col(sheet; keywords...)
Expand Down
Loading
Loading