awalker89 / openxlsx

R package for .xlsx file reading and writing.
Other
364 stars 79 forks source link

Cannot get df reading named range #433

Open capitantyler opened 5 years ago

capitantyler commented 5 years ago

tablas_actuariales.xlsx

Expected Behavior

Cannot get df reading named range. I tried with "GAM71_a_FEM" (range "'a(X,Y,FEM)'!$L$3:$U$99")

df <- read.xlsx(xlsxFile =  "tablas_actuariales.xlsx"
, namedRegion = "GAM71_a_FEM"
)

However, getNamedregions works well

getNamedRegions("tablas_actuariales.xlsx")
 [1] "_xlnm._FilterDatabase"                 
 [2] "_xlnm._FilterDatabase"                 
 [3] "AS2DocOpenMode"                        
 [4] "DA_2788203737700000632"                
 [5] "DL5b95cb4e_32a1_4252_900b_cce7b0339dbe"
 [6] "GAM71_a_FEM"                           
 [7] "GAM71_a_MASC"                          
 [8] "GAM71_E_FEM"                           
 [9] "GAM71_E_MASC"                          
[10] "GAM71_FEM"                             
[11] "GAM71_MASC"                            
[12] "MI85_a_FEM"                            
[13] "MI85_a_MASC"                           
[14] "MI85_E_FEM"                            
[15] "MI85_E_MASC"                           
[16] "MI85_FEM"                              
[17] "MI85_MASC"                             
[18] "TextRefCopyRangeCount"                 
attr(,"sheet")
 [1] "Cálculo"    "Datos M"     "Cálculo"    "Cálculo"    "a(X,Y,FEM)" 
 [6] "a(X,Y,MASC)" "E(X,Y,FEM)"  "E(X,Y,MASC)" "Tabla F"     "Tabla M"    
[11] "a(X,Y,FEM)"  "a(X,Y,MASC)" "E(X,Y,FEM)"  "E(X,Y,MASC)" "Tabla F"    
[16] "Tabla M"    
attr(,"position")
 [1] "A13:BZ20" "C8:H2144" "F20"      "BU4:BU5"  "L3:U99"   "L3:U99"   "J3:Q99"  
 [8] "J3:Q99"   "Q5:AE116" "Q5:AE116" "A3:J104"  "A3:J104"  "A3:H103"  "A3:H103" 
[15] "A5:O121"  "A5:O121"  

Actual Behavior

df <- read.xlsx(xlsxFile =  "tablas_actuariales.xlsx"
, namedRegion = "GAM71_a_FEM"
)
Error in gsub(sheet, "", region, fixed = TRUE) : 
  invalid 'pattern' argument

Steps to Reproduce the Problem

(please attach an example xlsx file if possible)

1.

2.

3.

sessionInfo()

R version 3.5.1 beta (2018-06-21 r74927) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale: [1] LC_COLLATE=Spanish_Argentina.1252 LC_CTYPE=Spanish_Argentina.1252
[3] LC_MONETARY=Spanish_Argentina.1252 LC_NUMERIC=C
[5] LC_TIME=Spanish_Argentina.1252

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] openxlsx_4.1.0 dplyr_0.7.7 readxl_1.1.0