Skip to content

Instantly share code, notes, and snippets.

@jeroenjanssens
Created September 21, 2017 10:24
Show Gist options
  • Save jeroenjanssens/f8d2fd1d8768b876352c0f4d92e0cefc to your computer and use it in GitHub Desktop.
Save jeroenjanssens/f8d2fd1d8768b876352c0f4d92e0cefc to your computer and use it in GitHub Desktop.
library(tidyverse)
library(magrittr)
library(stringr)
library(readxl)
directory <- "bunch/of/excel/files"
# Get an overview of all the Excel files and their sheets
sheets <-
data_frame(file = list.files(directory, full.names = TRUE),
sheet = map(file, possibly(excel_sheets, otherwise = NA))) %>%
unnest(sheet) %T>%
View(title = "Overview")
# Read in the first 20 rows of every sheet and display in Data Viewer
sheets %>%
drop_na() %>%
mutate(df = map2(file, sheet, read_excel, n_max = 20)) %$%
walk2(df, str_c("[", file, "]", sheet), View)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment