


## Extract the names from rawsheets
nms.list <- names(rawsheets)

## some names are  'Dec13' others are 'Dec 2013'  -- Clean this
nms.list <- gsub('([A-Z][a-z][a-z][a-z]?)([0-9][0-9])',  '\\1 20\\2', nms.list)
nms.list <- gsub("\\s*Revenue", "", nms.list)

## Clean names like Sept, June, July to Sep, Jun, Jul
for (mm in month.abb)
  nms.list <- gsub(paste0(mm, '[a-z]*'), mm, nms.list)

## Assign back into the list
names(rawsheets) <- nms.list

## Convert the names to an actual date
nams.list_as_dates <- as.Date(paste('01', nms.list), format="%d %b %Y")


### ------- NOW, we need to clean all the column names to be relative to the current month ------ ##
DT1 <- rawsheets[[1]]
DT2 <- rawsheets[[2]]
DT7 <- rawsheets[[7]]
DT13 <- rawsheets[[13]]

nms1 <- names(DT1)
nms2 <- names(DT2)
nms7 <- names(DT7)
nms13 <- names(DT13)

nwhich(!setNames(nms7==nms1, nms7))


(setNames(sapply(rawsheets, function(r) length(r)), seq(rawsheets)))

format(Sys.Date(), "%B %Y")
TrueUp 
Actual 
Estimate

