0

I have a zipped file named "mygeodata.zip" in my desktop. This file contains two excel sheets of form xlsx, named "NOMES.xlsx" and "POLIGONAIS.xlsx"

I was wondering how I could read this zipped folder in R from my desktop.

  • Have a look at `?unzip`. Maybe also useful: https://stackoverflow.com/questions/12460938/r-reading-in-a-zip-data-file-without-unzipping-it/12950811 – stefan Jul 24 '21 at 21:02

1 Answers1

0

You can extract the zipped files in a folder with unzip. Use list.files to read the two files individually.

library(readxl)

unzip("mygeodata.zip", exdir = 'temp')
files <- list.files('temp', pattern = 'xlsx$', full.names = TRUE)

file1 <- read_excel(files[1])
file2 <- read_excel(files[2])

Or use lapply to read them in a list.

list_data <- lapply(file1, read_excel)
Ronak Shah
  • 377,200
  • 20
  • 156
  • 213