Skip to content

Commit

Permalink
base data type detection on max. rows in EXCEL
Browse files Browse the repository at this point in the history
  • Loading branch information
mrustl committed Jun 11, 2018
1 parent 5fa981c commit f81be82
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions R/read_bwb_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ read_bwb_header1_meta <- function(
metadata <- all_metadata[all_metadata$Sheet == sheet, ]

# Load the data from the current sheet
tmp_data <- readxl::read_excel(file, sheet)
tmp_data <- readxl::read_excel(file, sheet, guess_max = 2^20)

# Safely select the original column names
columns_orig <- kwb.utils::selectColumns(metadata, "OriginalName")
Expand Down Expand Up @@ -165,7 +165,7 @@ read_bwb_header4 <- function(
{
# Define helper functions
read_from_excel <- function(...) {
readxl::read_xlsx(..., col_names = FALSE)
readxl::read_xlsx(..., col_names = FALSE, guess_max = 2^20)
}

sheets <- readxl::excel_sheets(file)
Expand Down
10 changes: 9 additions & 1 deletion main.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ paths <- list(
downloads = "<home>/Downloads",
input_dir = "<drive>/02_Daten_Labor_Aufbereitung_02",
export_dir = "<drive>/03_ANALYSIS_R/tmp",
export_dir_allg = "<export_dir>/K-TL_LSW-Altdaten-Werke Teil 1/Werke Teil 1/Allgemein",
sel_folder = "K-TL_LSW-Altdaten-Werke Teil 1/Werke Teil 1/Buch",
input_dir_sel = "<input_dir>/<sel_folder>",
export_dir_sel = "<export_dir>/<sel_folder>",
home = get_homedir()
)

Expand All @@ -72,6 +74,12 @@ if (FALSE)
# Convert xls to xlsx Excel files
convert_xls_as_xlsx(input_dir, export_dir)

if (FALSE) {
convert_xls_as_xlsx(input_dir = paths$input_dir_sel,
export_dir = paths$export_dir_sel)
}


# Copy remaining already existing .xlsx files in same directory
copy_xlsx_files(input_dir, export_dir, overwrite = TRUE)
}
Expand Down

0 comments on commit f81be82

Please sign in to comment.