Browse Source

fix import

Dasflugen 5 years ago
parent
commit
a6531834bb
1 changed files with 8 additions and 4 deletions
  1. 8 4
      schedule/xlsx.go

+ 8 - 4
schedule/xlsx.go

@@ -17,10 +17,14 @@ func ImportXLSX(filename string) []*PlanXLSX {
     }
     for _, sheet := range xlFile.Sheets {
         var plan = new(PlanXLSX)
-        plan.ProgramCode   = sheet.Cell(5,1).String()
-        plan.NameCode      = strings.Split(sheet.Cell(5,6).String(), " ")[0]
-        plan.PeriodOfStudy = sheet.Cell(7,6).String()
-        splited := strings.Split(sheet.Cell(9,1).String(), " ")
+        x, _ := sheet.Cell(5, 1)
+        plan.ProgramCode = x.String()
+        namecode, _ := sheet.Cell(5,6)
+        plan.NameCode      = strings.Split(namecode.String(), " ")[0]
+        pof, _ := sheet.Cell(7,6)
+        plan.PeriodOfStudy = pof.String()
+        spl, _ := sheet.Cell(9,1)
+        splited := strings.Split(spl.String(), " ")
         plan.GroupNumber   = strings.Split(splited[len(splited)-1], "-")[0]
 
         for i, row := range sheet.Rows {