Functions related to Excel

library(thinkr)

excel_names : dealing with column names and position number

  • ncol_to_excel() returns Excel column name from a position number.
  • excel_to_ncol() returns Excel column position number from a column name.
  • excel_col() returns all Excel column name.
ncol_to_excel(35)
#> [1] "AI"
excel_to_ncol("BF")
#> [1] 58
excel_col()
#>   [1] "A"  "B"  "C"  "D"  "E"  "F"  "G"  "H"  "I"  "J"  "K"  "L"  "M"  "N"  "O" 
#>  [16] "P"  "Q"  "R"  "S"  "T"  "U"  "V"  "W"  "X"  "Y"  "Z"  "AA" "AB" "AC" "AD"
#>  [31] "AE" "AF" "AG" "AH" "AI" "AJ" "AK" "AL" "AM" "AN" "AO" "AP" "AQ" "AR" "AS"
#>  [46] "AT" "AU" "AV" "AW" "AX" "AY" "AZ" "BA" "BB" "BC" "BD" "BE" "BF" "BG" "BH"
#>  [61] "BI" "BJ" "BK" "BL" "BM" "BN" "BO" "BP" "BQ" "BR" "BS" "BT" "BU" "BV" "BW"
#>  [76] "BX" "BY" "BZ" "CA" "CB" "CC" "CD" "CE" "CF" "CG" "CH" "CI" "CJ" "CK" "CL"
#>  [91] "CM" "CN" "CO" "CP" "CQ" "CR" "CS" "CT" "CU" "CV" "CW" "CX" "CY" "CZ" "DA"
#> [106] "DB" "DC" "DD" "DE" "DF" "DG" "DH" "DI" "DJ" "DK" "DL" "DM" "DN" "DO" "DP"
#> [121] "DQ" "DR" "DS" "DT" "DU" "DV" "DW" "DX" "DY" "DZ" "EA" "EB" "EC" "ED" "EE"
#> [136] "EF" "EG" "EH" "EI" "EJ" "EK" "EL" "EM" "EN" "EO" "EP" "EQ" "ER" "ES" "ET"
#> [151] "EU" "EV" "EW" "EX" "EY" "EZ" "FA" "FB" "FC" "FD" "FE" "FF" "FG" "FH" "FI"
#> [166] "FJ" "FK" "FL" "FM" "FN" "FO" "FP" "FQ" "FR" "FS" "FT" "FU" "FV" "FW" "FX"
#> [181] "FY" "FZ" "GA" "GB" "GC" "GD" "GE" "GF" "GG" "GH" "GI" "GJ" "GK" "GL" "GM"
#> [196] "GN" "GO" "GP" "GQ" "GR" "GS" "GT" "GU" "GV" "GW" "GX" "GY" "GZ" "HA" "HB"
#> [211] "HC" "HD" "HE" "HF" "HG" "HH" "HI" "HJ" "HK" "HL" "HM" "HN" "HO" "HP" "HQ"
#> [226] "HR" "HS" "HT" "HU" "HV" "HW" "HX" "HY" "HZ" "IA" "IB" "IC" "ID" "IE" "IF"
#> [241] "IG" "IH" "II" "IJ" "IK" "IL" "IM" "IN" "IO" "IP" "IQ" "IR" "IS" "IT" "IU"
#> [256] "IV" "IW" "IX" "IY" "IZ" "JA" "JB" "JC" "JD" "JE" "JF" "JG" "JH" "JI" "JJ"
#> [271] "JK" "JL" "JM" "JN" "JO" "JP" "JQ" "JR" "JS" "JT" "JU" "JV" "JW" "JX" "JY"
#> [286] "JZ" "KA" "KB" "KC" "KD" "KE" "KF" "KG" "KH" "KI" "KJ" "KK" "KL" "KM" "KN"
#> [301] "KO" "KP" "KQ" "KR" "KS" "KT" "KU" "KV" "KW" "KX" "KY" "KZ" "LA" "LB" "LC"
#> [316] "LD" "LE" "LF" "LG" "LH" "LI" "LJ" "LK" "LL" "LM" "LN" "LO" "LP" "LQ" "LR"
#> [331] "LS" "LT" "LU" "LV" "LW" "LX" "LY" "LZ" "MA" "MB" "MC" "MD" "ME" "MF" "MG"
#> [346] "MH" "MI" "MJ" "MK" "ML" "MM" "MN" "MO" "MP" "MQ" "MR" "MS" "MT" "MU" "MV"
#> [361] "MW" "MX" "MY" "MZ" "NA" "NB" "NC" "ND" "NE" "NF" "NG" "NH" "NI" "NJ" "NK"
#> [376] "NL" "NM" "NN" "NO" "NP" "NQ" "NR" "NS" "NT" "NU" "NV" "NW" "NX" "NY" "NZ"
#> [391] "OA" "OB" "OC" "OD" "OE" "OF" "OG" "OH" "OI" "OJ" "OK" "OL" "OM" "ON" "OO"
#> [406] "OP" "OQ" "OR" "OS" "OT" "OU" "OV" "OW" "OX" "OY" "OZ" "PA" "PB" "PC" "PD"
#> [421] "PE" "PF" "PG" "PH" "PI" "PJ" "PK" "PL" "PM" "PN" "PO" "PP" "PQ" "PR" "PS"
#> [436] "PT" "PU" "PV" "PW" "PX" "PY" "PZ" "QA" "QB" "QC" "QD" "QE" "QF" "QG" "QH"
#> [451] "QI" "QJ" "QK" "QL" "QM" "QN" "QO" "QP" "QQ" "QR" "QS" "QT" "QU" "QV" "QW"
#> [466] "QX" "QY" "QZ" "RA" "RB" "RC" "RD" "RE" "RF" "RG" "RH" "RI" "RJ" "RK" "RL"
#> [481] "RM" "RN" "RO" "RP" "RQ" "RR" "RS" "RT" "RU" "RV" "RW" "RX" "RY" "RZ" "SA"
#> [496] "SB" "SC" "SD" "SE" "SF" "SG" "SH" "SI" "SJ" "SK" "SL" "SM" "SN" "SO" "SP"
#> [511] "SQ" "SR" "SS" "ST" "SU" "SV" "SW" "SX" "SY" "SZ" "TA" "TB" "TC" "TD" "TE"
#> [526] "TF" "TG" "TH" "TI" "TJ" "TK" "TL" "TM" "TN" "TO" "TP" "TQ" "TR" "TS" "TT"
#> [541] "TU" "TV" "TW" "TX" "TY" "TZ" "UA" "UB" "UC" "UD" "UE" "UF" "UG" "UH" "UI"
#> [556] "UJ" "UK" "UL" "UM" "UN" "UO" "UP" "UQ" "UR" "US" "UT" "UU" "UV" "UW" "UX"
#> [571] "UY" "UZ" "VA" "VB" "VC" "VD" "VE" "VF" "VG" "VH" "VI" "VJ" "VK" "VL" "VM"
#> [586] "VN" "VO" "VP" "VQ" "VR" "VS" "VT" "VU" "VV" "VW" "VX" "VY" "VZ" "WA" "WB"
#> [601] "WC" "WD" "WE" "WF" "WG" "WH" "WI" "WJ" "WK" "WL" "WM" "WN" "WO" "WP" "WQ"
#> [616] "WR" "WS" "WT" "WU" "WV" "WW" "WX" "WY" "WZ" "XA" "XB" "XC" "XD" "XE" "XF"
#> [631] "XG" "XH" "XI" "XJ" "XK" "XL" "XM" "XN" "XO" "XP" "XQ" "XR" "XS" "XT" "XU"
#> [646] "XV" "XW" "XX" "XY" "XZ" "YA" "YB" "YC" "YD" "YE" "YF" "YG" "YH" "YI" "YJ"
#> [661] "YK" "YL" "YM" "YN" "YO" "YP" "YQ" "YR" "YS" "YT" "YU" "YV" "YW" "YX" "YY"
#> [676] "YZ" "ZA" "ZB" "ZC" "ZD" "ZE" "ZF" "ZG" "ZH" "ZI" "ZJ" "ZK" "ZL" "ZM" "ZN"
#> [691] "ZO" "ZP" "ZQ" "ZR" "ZS" "ZT" "ZU" "ZV" "ZW" "ZX" "ZY" "ZZ"
ncol_to_excel(1:6)
#> [1] "A" "B" "C" "D" "E" "F"
excel_to_ncol(c('AF', 'AG', 'AH'))
#> [1] 32 33 34