knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "README-"
)

lifecycle

excelgesis

The goal of excelgesis is to make the XML files inside Excel's .xlsx files navigable in a web browser. It's a helper package for the development and debugging of readxl. excelgesis itself is intended for strictly for personal, diagnostic, and recreational use.

Despite zero planning on my part, it works equally well for other Office Open XML File Formats, like Word and PowerPoint. A happy fact pointed out to me on Twitter.

You can explore some unpacked Excel workbooks here, drawn from the readxl example and test sheets:

https://jennybc.github.io/excelgesis/

Those same workbooks are available in .xlsx form in the excelgesis package. Use xg_example() to gain access.

The definitive reference for .xlxs is Standard ECMA-376 Office Open XML File Formats:

Installation

You can install excelgesis from github with:

# install.packages("devtools")
devtools::install_github("jennybc/excelgesis")

Usage

List the included examples.

library(excelgesis)
xg_example()

Browse around the underlying XML inside those xlsx workbooks:

https://jennybc.github.io/excelgesis/

Here's how to do the same locally for the example workbook about Clippy:

try(fs::dir_delete("clippy"))
try(fs::file_delete("clippy.xlsx"))
xg_example("clippy") %>%
  fs::file_copy(new_path = ".") %>% 
  xg_inspect()
try(fs::dir_delete("clippy"))
try(fs::file_delete("clippy.xlsx"))

In an interactive session, clippy's landing page will open in your browser for XML browsing fun times.

The convenience function xg_inspect() wraps up three operations:

Here's one last worked example using the individual functions.

try(fs::dir_delete("datasets"))
try(fs::file_delete("datasets.xlsx"))
(mg <- xg_example("datasets"))
mg %>% 
  fs::file_copy(new_path = ".") %>% 
  xg_unzip() %>% 
  xg_linkify() %>% 
  xg_browse()
try(fs::dir_delete("datasets"))
try(fs::file_delete("datasets.xlsx"))

You haven't really seen iris or mtcars until you've seen them as XML.



jennybc/excelgesis documentation built on Dec. 16, 2018, 11:20 a.m.