I am trying to read a worksheet in an Excel 2010 workbook file into R using both the xlsx
and XLConnect
packages. Both are dropping leading zeroes on zip code columns despite formatting the cells in the worksheet as 'Text'.
wb <- loadWorkbook('c:/~/file1.xlsx')
sheetNames <- getSheets(wb)
for(i in 1:length(sheetNames)){ # i = 2
#dat1 <- read.xlsx('c:/~/file1.xlsx', sheetNames[i], as.data.frame = T)
dat1 <- readWorksheetFromFile('c:/~/file1.xlsx', sheetNames[i])
}
Does anyone have suggestions for how to deal with this?