Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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