JPLTedCas commited on
Commit
57d4a1a
·
1 Parent(s): 1518074

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +39 -14
app.py CHANGED
@@ -23,25 +23,50 @@ if uploaded_file:
23
  def write_excel(data,date):
24
 
25
 
26
- # Python3 code to select
27
- # data from excel
28
- import xlwings as xw
29
 
30
- # Specifying a sheet
31
- ws = xw.Book("07-253-b Estudio capacidad (con grafico).xls").sheets['DATOS']
32
 
33
- # Selecting data from
34
- # a single cell
35
- v1 = ws.range("A1:A7").value
36
- # v2 = ws.range("F5").value
37
- print("Result:", v1)
38
- length=len(data)
39
- for i in range(len(date)):
40
  #ws.range(9+i,0).value = date[i]
41
  #ws.range(9+i,1).value = data[i]
42
  #ws.range(1,0).value = "pepe"
43
- ws.range("A"+str(9+i)).value = date[i]
44
- ws.range("B"+str(9+i)).value = data[i]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
 
46
  def KYBConvert(df,make_choice):
47
  #INPUT FILE
 
23
  def write_excel(data,date):
24
 
25
 
26
+ ## Python3 code to select
27
+ ## data from excel
28
+ #import xlwings as xw
29
 
30
+ ## Specifying a sheet
31
+ #ws = xw.Book("07-253-b Estudio capacidad (con grafico).xls").sheets['DATOS']
32
 
33
+ ## Selecting data from
34
+ ## a single cell
35
+ #v1 = ws.range("A1:A7").value
36
+ ##v2 = ws.range("F5").value
37
+ #print("Result:", v1)
38
+ #length=len(data)
39
+ #for i in range(len(date)):
40
  #ws.range(9+i,0).value = date[i]
41
  #ws.range(9+i,1).value = data[i]
42
  #ws.range(1,0).value = "pepe"
43
+ # ws.range("A"+str(9+i)).value = date[i]
44
+ # ws.range("B"+str(9+i)).value = data[i]
45
+ import xlwt
46
+ import xlrd
47
+ from xlutils.copy import copy
48
+
49
+ # load the excel file
50
+ rb = xlrd.open_workbook('07-253-b Estudio capacidad (con grafico).xls', formatting_info=True)
51
+
52
+ # copy the contents of excel file
53
+ wb = copy(rb)
54
+
55
+ # open the first sheet
56
+ w_sheet = wb.get_sheet(1)
57
+
58
+ # row number = 0 , column number = 1
59
+ w_sheet.write(0,1,'Modified !')
60
+ length=len(data)
61
+ for i in range(len(date)):
62
+ #ws.range("A"+str(9+i)).value = date[i]
63
+ #ws.range("B"+str(9+i)).value = data[i]
64
+ w_sheet.write(9+i,0,str(date[i]))
65
+ w_sheet.write(9+i,1,str(data[i]))
66
+
67
+
68
+ # save the file
69
+ wb.save('07-253-b Estudio capacidad (con grafico).xls')
70
 
71
  def KYBConvert(df,make_choice):
72
  #INPUT FILE