I asked this question before but it didn't really go anywhere. I've done more work on it but again I am stuck!
I have a spreadsheet with two tabs, one has 3 cells I am interested in (A2, A4, A6) which are identifying details, and the second tab has a 4X4 grid (A1: D4) which has some financial information.
I can make a data frame, and I can locate the data, and to a certain extent I can extract the data. My issue is looping the whole thing over all the files in the folder, and taking the data and applying it to the pre-created data frame.
Code below for your reference
Locating files
  list.files(
    path = "C:/Excel Files",
    pattern = '*.xlsx|*.XLSX',
    full.names = FALSE,
    recursive = FALSE
  ) 
Creating df
    colnames <- c( A2, A4, A6, A1, B1, C1, D1, A2, B2, C2, D2, A3, B3, C3, D3, A4, B4, C4, D4)
    output <- matrix(NA,nrow = length(file.list), ncol = length(colnames), byrow = FALSE)
    colnames(output) <- c(colnames)
    rownames(output) <- c(file.list)
extracting data
    FirmData1 <- readxl::read_xlsx("N:/Excel Files/test.xlsx", sheet = 2, range = "A1:D1", na = "", col_names = FALSE, col_types = "text")
    FirmData2 <- readxl::read_xlsx("N:/Excel Files/test.xlsx", sheet = 2, range = "A2:D2", na = "", col_names = FALSE, col_types = "text")
    FirmData3 <- readxl::read_xlsx("N:/Excel Files/test.xlsx", sheet = 2, range = "A3:D3", na = "", col_names = FALSE, col_types = "text")
    FirmData4 <- readxl::read_xlsx("N:/Excel Files/test.xlsx", sheet = 2, range = "A4:D4", na = "", col_names = FALSE, col_types = "text")
    FirmData <-  dplyr:: bind_rows(FirmData1, FirmData2, FirmData3, FirmData4)
    FirmData <- t(FirmData)
    colnames(output)
    Firm <- dplyr:: bind_rows(FirmInfo, FirmData) %>%
      tidyr:: spread(key = Field, value = Value)
loop
there is no loop!
 
     
    