# Get sheet namessheet_names <-excel_sheets(excel_file)# Function to read each sheet with some warning suppressionread_sheet_safe <-function(sheet) {suppressMessages(suppressWarnings(read_excel(excel_file, sheet = sheet, .name_repair ="universal", guess_max =10000) ) )}# Read all sheetsresults <-map(sheet_names, safely(read_sheet_safe))names(results) <- sheet_names# Identify sheets that failed to import (have only charts/figures)failed_sheets <-names(results)[map_lgl(results, ~!is.null(.x$error))]print(failed_sheets)
character(0)
# Exclude sheets with only charts/figuresvalid_sheets <-setdiff(sheet_names, failed_sheets)# Read only sheets with dataall_data <-map(valid_sheets, read_sheet_safe) %>%set_names(valid_sheets)