Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jennybc/excelgesis

Critical explanation or interpretation of ... Excel spreadsheets
https://github.com/jennybc/excelgesis

Last synced: about 2 months ago
JSON representation

Critical explanation or interpretation of ... Excel spreadsheets

Awesome Lists containing this project

README

        

---
output: github_document
---

```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```

[![lifecycle](https://img.shields.io/badge/lifecycle-works_for_me-ff69b4.svg)](https://blog.codinghorror.com/the-works-on-my-machine-certification-program/)

# 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](http://readxl.tidyverse.org). 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](https://twitter.com/tonmcg/status/977214628240408578).

You can explore some unpacked Excel workbooks here, drawn from the readxl [example](https://github.com/tidyverse/readxl/tree/master/inst/extdata) and [test](https://github.com/tidyverse/readxl/tree/master/tests/testthat/sheets) sheets:

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:

```{r gh-installation, eval = FALSE}
# install.packages("devtools")
devtools::install_github("jennybc/excelgesis")
```

## Usage

List the included examples.

```{r}
library(excelgesis)
xg_example()
```

Browse around the underlying XML inside those xlsx workbooks:

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

```{r include = FALSE, error = TRUE}
try(fs::dir_delete("clippy"))
try(fs::file_delete("clippy.xlsx"))
```

```{r}
xg_example("clippy") %>%
fs::file_copy(new_path = ".") %>%
xg_inspect()
```

```{r include = FALSE, error = TRUE}
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:

* Unzip the ZIP archive -- `xg_unzip()`
* Make the unpacked files more pleasant for browsing -- `xg_linkify()`
* Visit the top-level 'index.html' in your default browser -- `xg_browse()`

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

```{r include = FALSE}
try(fs::dir_delete("datasets"))
try(fs::file_delete("datasets.xlsx"))
```

```{r}
(mg <- xg_example("datasets"))
mg %>%
fs::file_copy(new_path = ".") %>%
xg_unzip() %>%
xg_linkify() %>%
xg_browse()
```

```{r include = FALSE}
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.