https://github.com/Bisaloo/xlcutter
Parse Batches of 'xlsx' Files Based on a Template
https://github.com/Bisaloo/xlcutter
data-extraction excel non-rectangular-data r r-package tidy-data
Last synced: 4 months ago
JSON representation
Parse Batches of 'xlsx' Files Based on a Template
- Host: GitHub
- URL: https://github.com/Bisaloo/xlcutter
- Owner: Bisaloo
- License: other
- Created: 2022-12-04T16:01:40.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-10T12:14:54.000Z (about 1 year ago)
- Last Synced: 2024-10-24T16:18:22.599Z (4 months ago)
- Topics: data-extraction, excel, non-rectangular-data, r, r-package, tidy-data
- Language: R
- Homepage: https://hugogruson.fr/xlcutter/
- Size: 4.5 MB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.Rmd
- Changelog: NEWS.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Codemeta: codemeta.json
Awesome Lists containing this project
- jimsghstars - Bisaloo/xlcutter - Parse Batches of 'xlsx' Files Based on a Template (R)
README
---
output: github_document
---```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```# xlcutter
[](https://opensource.org/license/mit/)
[](https://github.com/Bisaloo/xlcutter/actions/workflows/R-CMD-check.yaml)
[](https://app.codecov.io/gh/Bisaloo/xlcutter?branch=main)
[](https://www.reconverse.org/lifecycle.html#concept)This package allows you to parse entire folders of non-rectangular 'xlsx' files
into a single rectangular and tidy 'data.frame' based on a custom template file
defining the column names of the output.## Installation
You can install the latest stable version of this package from CRAN:
``` r
install.packages("xlcutter")
```or the development version from [GitHub](https://github.com/) with:
``` r
# install.packages("remotes")
remotes::install_github("Bisaloo/xlcutter")
```## Example
Non-rectangular excel files are common in many domains. For a simple
demonstration here, we use the example of the ["Blue
timesheet"](https://templates.office.com/en-us/blue-timesheet-tm77799521) from
, where employees can log their working hours.A typical use case of xlcutter in this example would be for a manager who want
to get a single rectangular dataset with the timesheets from different
employees.
Your first step to extract the data is to define the various columns you want
in the output in a *template* file. You can mark the data cells to extract with
any custom marker, with the default being `{{ column_name }}`.
```{r}
library(xlcutter)data_files <- list.files(
system.file("example", "timesheet", package = "xlcutter"),
pattern = "\\.xlsx$",
full.names = TRUE
)template_file <- system.file(
"example", "timesheet_template.xlsx",
package = "xlcutter"
)xlsx_cutter(
data_files,
template_file
)
```## Other example of use cases
Other typical use cases for this package could be:
- an hospital that wants to collate non-rectangular information sheets from
different patients into a single rectangular dataset