Save Excel spreadsheet as .csv with R?

后端 未结 3 1715
星月不相逢
星月不相逢 2021-02-15 11:27

What is the simplest way to convert a large Excel spreadsheet with multiple worksheets into .CSV files in R?

Note that I\'ve tested XLConnect and XLSX and found that m

3条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-15 11:57

    Updated answer based on readxl package.

    library("readxl")
    
    #function to read all sheets of a workbook
    read_excel_allsheets <- function(filename) {
      sheets <- readxl::excel_sheets(filename)
      x <-    lapply(sheets, function(X) readxl::read_excel(filename, sheet = X))
      names(x) <- sheets
      x
    }
    
    sheetnames <- read_excel_allsheets("excelFile.xlsx")
    names(sheetnames)
    

提交回复
热议问题