title: Extract the number of sheets from an Excel workbook in R (without XLConnect)
body: <p>I'm relatively new to R (and programming).
  I have an Excel workbook with 36 sheets, but suppose that I don't know how many sheets there are and I want my code to find that out for me. I have tried something like:</p>
  
  <pre><code>options(java.parameters = "-Xmx6g")
  library(XLConnect)
  myWorkbook &lt;- loadWorkbook(filename)
  numberofsheets &lt;- length(getSheets(myWorkbook))
  </code></pre>
  
  <p>But even though I set my memory to 6GB I still run into memory errors with XLConnect, so I would like to use other packages (e.g. xlsx, openxlsx). Is there a way to find out the number of sheets in an Excel workbook without using XLConnect?
  Thanks for your help.</p>