Please correct my code. If i run the code without the colnames part it runs perfectly but i need to rename all the columns in these datasets. I'm not sure why this isn't working with the "colnames" function, I believe I'm not using it correctly. I don't know at what point the column names can be renamed accordingly.
Please, note that I'm looping through multiple datasets
##Extract all xlsx files in the directory stated
file_path <- "data_raw/Result_Summary/"
xlsx_file_names <- file_path %>% 
  list.files() %>% 
  .[str_detect(., ".xlsx")]
xlsx_file_names %>%
  purrr::map(function(file_name){ # iterate through each file name
    assign(x = str_remove(file_name, ".xlsx"), # Remove file extension ".xlsx"
           value = read_excel(paste0(file_path, file_name),sheet="Results Summary", range=c("B11:V120"),
            col_types = c("text", 
                          "guess", 
                          "guess", 
                          "numeric", 
                          "numeric", 
                          "numeric", 
                          "numeric", 
                          "numeric", 
                          "numeric",
                          "numeric",
                          "guess",
                          "numeric",
                          "numeric",
                          "guess",
                          "numeric",
                          "numeric",
                          "guess",
                          "numeric",
                          "numeric",
                          "guess",
                          "numeric")),
           envir = .GlobalEnv)
  })
rm(file_path, xlsx_file_names)
##combine all datasets in the Global Enviroment to a list ##
lst2 <- mget(ls())
lst2 <- map(lst2, ~ .x %>% ## Repeat the task below on all objects in the global enviroment
        filter(!is.na(Campaign)) %>% 
        filter(!Campaign == "Total")%>% 
          colnames(lst2) <- c("Campaign",
                              "Start_Date",
                              "End_Date",
                              "Total_Cost", 
                              "Households",
                              "Deposit_Account",
                              "Deposit_Balance",
                              "Num_Loan",
                              "Loan_Bal",
                              "Direct_Response",
                              "Direct_Response_Rate",
                              "Direct_Balances",
                              "Direct_Margin",
                              "Direct_Margin_ROI",
                              "Direct_Acquisition_Cost_Account",
                              "Indirect_Response",
                              "Indirect_Response_Rate",
                              "Indirect_Balances",
                              "Indirect_Margin",
                              "Indirect_Margin_ROI",
                              "Indirect_Acquisition_Cost_Account"))
                              #"Bad"))
 Error in ~.x %>% filter(!is.na(Campaign)) %>% filter(!Campaign == "Total") %>%  : 
  object '.x' not found
This is an update on the code, thanks to @Ronak Shah for his input. It's his code, i only changed the order because that made the code to run without error.So, I'm including the code below for whoever has been following.
file_path <- "data_raw/Result_Summary/"
xlsx_file_names <- file_path %>% 
  list.files() %>% 
  .[str_detect(., ".xlsx")]
xlsx_file_names %>%
  purrr::map(function(file_name){ # iterate through each file name
    assign(x = str_remove(file_name, ".xlsx"), # Remove file extension ".xlsx"
           value = read_excel(paste0(file_path, file_name),sheet="Results Summary", range=c("B11:V120"),
            col_types = c("text", 
                          "guess", 
                          "guess", 
                          "numeric", 
                          "numeric", 
                          "numeric", 
                          "numeric", 
                          "numeric", 
                          "numeric",
                          "numeric",
                          "guess",
                          "numeric",
                          "numeric",
                          "guess",
                          "numeric",
                          "numeric",
                          "guess",
                          "numeric",
                          "numeric",
                          "guess",
                          "numeric")),
           envir = .GlobalEnv)
  })
rm(file_path, xlsx_file_names)
##combine all datasets in the Global Enviroment to a list ##
lst2 <- mget(ls())
lst2 <- map(lst2, ~ .x %>% ## Repeat the task below on all objects in the global enviroment
              rename_all(~c("Campaign",
                            "Start_Date",
                            "End_Date",
                            "Total_Cost", 
                            "Households",
                            "Deposit_Account",
                            "Deposit_Balance",
                            "Num_Loan",
                            "Loan_Bal",
                            "Direct_Response",
                            "Direct_Response_Rate",
                            "Direct_Balances",
                            "Direct_Margin",
                            "Direct_Margin_ROI",
                            "Direct_Acquisition_Cost_Account",
                            "Indirect_Response",
                            "Indirect_Response_Rate",
                            "Indirect_Balances",
                            "Indirect_Margin",
                            "Indirect_Margin_ROI",
                            "Indirect_Acquisition_Cost_Account")) %>% 
                            #"Bad"))
              filter(!is.na(Campaign)) %>% 
              filter(!Campaign == "Total"))
 
     
     
    