Get startedGet started for free

Removing sheets

After presenting the new Excel sheet to your peers, it appears not everybody is a big fan. Why summarize sheets and store the info in Excel if all the information is implicitly available? To hell with it, just remove the entire fourth sheet!

This exercise is part of the course

Importing Data in R (Part 1)

View Course

Exercise instructions

  • Load the XLConnect package.
  • Build a connection to "renamed.xlsx", the Excel file that you've built in the previous exercise; it's available in your working directory. Store this connection as my_book.
  • Use removeSheet() to remove the fourth sheet from my_book. The sheet name is "summary".
  • Save the resulting workbook, my_book, to a file "clean.xslx".

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Load the XLConnect package


# Build connection to renamed.xlsx: my_book


# Remove the fourth sheet


# Save workbook to "clean.xlsx"
Edit and Run Code