Compare Excel files (.xlsx) cell by cell. Unlike standard table comparison tools, excelcompare captures every cell in a worksheet - including titles, footnotes, and annotations that live outside the main data table.
Installation
You can install the development version of excelcompare from GitHub with:
# install.packages("pak")
pak::pak("SchmidtPaul/excelcompare")Example
library(excelcompare)
# Paths to example Excel files shipped with the package
path1 <- system.file("extdata", "example1.xlsx", package = "excelcompare")
path2 <- system.file("extdata", "example2.xlsx", package = "excelcompare")
# Compare the two files
diff <- compare_xlsx(path1, path2)
# The result is a tibble with one row per difference
diff
#>
#> ── Excel Comparison ────────────────────────────────────────────────────────────
#> Sheet: "Sheet1" | 2 differences
#>
#> A1: Title -> Different Title [modified]
#> A4: 2 -> 99 [modified]
# The print method shows waldo-inspired diffs
print(diff)
#>
#> ── Excel Comparison ────────────────────────────────────────────────────────────
#> Sheet: "Sheet1" | 2 differences
#>
#> A1: Title -> Different Title [modified]
#> A4: 2 -> 99 [modified]Features
- Cell-level comparison - Detects differences in any cell, not just tabular data
-
Numeric tolerance -
toleranceparameter for floating-point comparison -
NA-equals-zero -
na_equals_zeroparameter to treat empty cells and zeros as equal -
Multi-sheet support - Compare specific or all shared sheets (
sheetparameter) - Clean diff output - S3 print/summary methods with waldo-inspired formatting
-
safe_to_numeric()- Exported utility for robust numeric conversion (handles European formats, thousand separators)
Learn more
Built on {tidyxl} for comprehensive Excel cell reading. Only supports modern Excel formats (.xlsx, .xlsm).