-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStreamlite.py
85 lines (39 loc) · 1.76 KB
/
Streamlite.py
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
79
80
81
82
83
84
85
import streamlit as st
import pandas as pd
import numpy as np
import os
import plotting
import Selenium
##Variables
filepathXLSX = 'C:/Users/iamfl/Desktop/Skripte/PapaFBA/ExcelTest/'
def save_uploadedfile(uploadedfile, filepath):
with open(os.path.join(filepath,uploadedfile.name),"wb") as f:
f.write(uploadedfile.getbuffer())
return st.success(f"Saved File:{uploadedfile.name} to {filepath}.")
def listFiles(dirpath):
return os.listdir(dirpath)
def FileDropdown(dirpath):
fileList = listFiles(dirpath)
option = st.selectbox("Alle hochgeladenen Dateien", fileList)
if option:
df = pd.read_excel(dirpath+option)
st.write(df)
st.success(f"Angezeigte Datei:{option}!")
download = st.download_button("Download this file?", data=dirpath+option)
st.success(f"Heruntergeladene Datei:{option}!")
delete = st.button("Diese Datei löschen?")
if delete:
os.remove(dirpath+option)
st.success(f"Gelöschte Datei:{option}!")
return None
def makePlotsDropdown(jsonDIR):
js_dicts, filenames = plotting.readJSONS(jsonDIR)
option = st.selectbox("Alle hochgeladenen Dateien", filenames)
if option:
dfs = plotting.makeDataframe(js_dicts, option)
#{Dateiname: {unique_link1:[[timestamp, preis, Stock],[timestamp, preis, Stock]]}
st.title('Amazon FBA Scanner!')
Uploaded_files = st.file_uploader(".xlsx Dateien mit Amazon Links bitte hochladen!", type=".xlsx", accept_multiple_files=True)
for file in Uploaded_files:
save_uploadedfile(file, filepathXLSX)
FileDropdown(filepathXLSX)