title: Path must be a string error when reading an xlsx file in R
body: <pre><code>library(dplyr)
  library(data.table)
  library(readxl)
  
  macro &lt;-
    list()
  
  macro$filepath &lt;-
    'C:\\Users\\TMC\\Documents'
  
  macro$file &lt;-
    list.files(
      macro$filepath, 
      pattern = 'EventData.xlsx',
      full.names = TRUE)
  
  macro$sheet &lt;- 
    'FY21'
  
  macro$first_dt &lt;- 
    '2021-02-01' %&gt;% as.Date
  
  dat &lt;-
    macro$file[regexpr('~', macro$file) &lt; 0] %&gt;% 
    read_xlsx(., sheet = macro$sheet) %&gt;% 
    data.table
  
  dat &lt;- 
    dat[!(DESCRIPTION %in% 'AEG')]
  
  macro$keep &lt;-
    c(
      'Product vs. buzz', 
      'CATEGORY', 
      'JUN', 
      'JUL', 
      'AUG', 
      'SEP', 
      'OCT', 
      'NOV', 
      'DEC', 
      'JAN', 
      'FEB', 
      'MAR',
      'APR', 
      'MAY')
  
  dat &lt;- 
    dat[
      , 
      intersect(macro$keep, dat %&gt;% names), 
      with = FALSE]
  
  setnames(
    dat,
    c('Product vs. buzz', 'CATEGORY'), 
    c('evt_type', 'raw'))
  
  dat[, raw := (raw %&gt;% tolower)]
  
  ##ISSUE IS HERE
  macro$category &lt;-
    list.files(
      macro$filepath, 
      pattern = 'BrandEventCategoryMapping', 
      full.names = TRUE) %&gt;% 
    read_xlsx %&gt;% 
    data.table
  </code></pre>
  <p>Hi all, I am trying to run the above code in R. when I try to read the excel file in the macro$category section I get the following error:</p>
  <pre><code>Error: `path` must be a string
  </code></pre>
  <p>Can anyone please help me out and let me know what I should do or edit to fix this? I am not good at R and have to unfortunately run someone else's script for a time sensitive deadline. I would really appreciate some help!</p>