BramLeo commited on
Commit
d1f445d
·
verified ·
1 Parent(s): f5ae5ed

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -5
app.py CHANGED
@@ -35,11 +35,17 @@ def read_google_sheets_separated():
35
  if sheet_name == "datatarget":
36
  for row in rows:
37
  if len(row) >= 4:
38
- jumlah = int(row[3])
39
- status = "KURANG" if jumlah < 0 else "LEBIH"
40
- entries.append(
41
- f"[SELISIH] Mesin: {row[0]} | Kategori: {row[1]} | Bulan: {row[2]} | Selisih: {abs(jumlah)} pcs ({status})"
42
- )
 
 
 
 
 
 
43
 
44
  elif sheet_name == "datacuti":
45
  for row in rows:
 
35
  if sheet_name == "datatarget":
36
  for row in rows:
37
  if len(row) >= 4:
38
+ try:
39
+ jumlah = int(row[3])
40
+ status = "KURANG" if jumlah < 0 else "LEBIH"
41
+ entries.append(
42
+ f"[SELISIH] Mesin: {row[0]} | Kategori: {row[1]} | Bulan: {row[2]} | Selisih: {abs(jumlah)} pcs ({status})"
43
+ )
44
+ except ValueError:
45
+ # Tangani jika data tidak valid
46
+ entries.append(
47
+ f"[WARNING] Data tidak valid: {' | '.join(row)}"
48
+ )
49
 
50
  elif sheet_name == "datacuti":
51
  for row in rows: