read reference csv from request
This commit is contained in:
@@ -57,6 +57,31 @@ def performance(request):
|
||||
start_date = "2023-12-04"
|
||||
end_date = "2023-12-05"
|
||||
|
||||
if 'file' not in request.files:
|
||||
print('No file part')
|
||||
|
||||
file = request.files['file']
|
||||
|
||||
if file.filename == '':
|
||||
print('No selected file')
|
||||
|
||||
# Save the file to a temporary location
|
||||
temp_filepath = '/tmp/temp_file.csv'
|
||||
file.save(temp_filepath)
|
||||
|
||||
# Load the file into a Pandas DataFrame
|
||||
try:
|
||||
df_reference_device_raw = pd.read_csv(temp_filepath) # Adjust the read method based on your file type (e.g., read_excel for Excel files)
|
||||
# Now you can work with the DataFrame (e.g., perform analysis or display it)
|
||||
print(df_reference_device_raw.head())
|
||||
print('File uploaded and loaded into DataFrame successfully')
|
||||
except Exception as e:
|
||||
print(f'Error loading the file: {str(e)}')
|
||||
finally:
|
||||
# Remove the temporary file
|
||||
os.remove(temp_filepath)
|
||||
|
||||
|
||||
path_delim = "/"
|
||||
|
||||
db = firestore.client()
|
||||
|
||||
Reference in New Issue
Block a user