-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathReadingFromExcel.R
80 lines (54 loc) · 2.78 KB
/
ReadingFromExcel.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
### load MSTR workbook
source("ReadingFromExcel_Functions.R")
# library(XLConnect)
library(readxl)
# MSTRExcelWbPathPre = choose.files(caption = "Choose Pre-Quote export")
# MSTRExcelWbPathPost = choose.files(caption = "Choose Post-Bind export")
requiredSheets = c("Line Guide","Location Peril Region AAL","Location Details")
# MSTRExcelWb = loadWorkbook(MSTRExcelWbPath,create = FALSE)
###load sheets
LineGuidePreDF = read_excel(MSTRExcelWbPathPre,sheet = "Line Guide")
LineGuidePostDF = read_excel(MSTRExcelWbPathPost,sheet = "Line Guide")
##extracting relavant DFs Pre
##TODO : Handle No Data Available rows
AccountDetailsPreDF = LineGuidePreDF %>%
extractDFfromLineGuide("Account Name") %>%
removeAllNAColumns() %>% .[,1:2]
PolicyLevelTermsPreDF = LineGuidePreDF %>%
extractDFfromLineGuide("Policy Level Terms") %>%
cleanUpExtractedDF()
#handle layername differenelty
TCPPreDF = LineGuidePreDF %>%
extractDFfromLineGuide_ForLayerName("Layer Name") %>%
cleanUpExtractedDF()
PerilLevelTermsPreDF = LineGuidePreDF %>%
extractDFfromLineGuide("Peril Level Terms") %>%
cleanUpExtractedDF()
PerilSublimitsPreDF = LineGuidePreDF %>%
extractDFfromLineGuide("Peril Sublimits") %>%
cleanUpExtractedDF()
LocationGroupSublimitsPreDF = LineGuidePreDF %>%
extractDFfromLineGuide("Location Group Sublimits") %>%
cleanUpExtractedDF()
### Extract relavant DFs for Post
AccountDetailsPostDF = LineGuidePostDF %>%
extractDFfromLineGuide("Account Name") %>%
removeAllNAColumns() %>% .[,1:2]
PolicyLevelTermsPostDF = LineGuidePostDF %>%
extractDFfromLineGuide("Policy Level Terms") %>%
cleanUpExtractedDF()
#handle layername differenelty
TCPPostDF = LineGuidePostDF %>%
extractDFfromLineGuide_ForLayerName("Layer Name") %>% cleanUpExtractedDF()
PerilLevelTermsPostDF = LineGuidePostDF %>%
extractDFfromLineGuide("Peril Level Terms") %>%
cleanUpExtractedDF()
PerilSublimitsPostDF = LineGuidePostDF %>%
extractDFfromLineGuide("Peril Sublimits") %>%
cleanUpExtractedDF()
LocationGroupSublimitsPostDF = LineGuidePostDF %>%
extractDFfromLineGuide("Location Group Sublimits") %>%
cleanUpExtractedDF()
##QUestion: Difference between Location Details and Line Guide Location details
##Q : will the number of locations increase when there are more layers in line guide
##Q: