Commit 63ea265c by ajil.k

updateded

parent 1540973e
...@@ -3,4 +3,7 @@ mongo_uri = mongodb://localhost:27017/ ...@@ -3,4 +3,7 @@ mongo_uri = mongodb://localhost:27017/
[FastAPI] [FastAPI]
port = 5000 port = 5000
\ No newline at end of file
[Excel_file]
xlsx_path = temp/mongodb_data.xlsx
\ No newline at end of file
...@@ -10,3 +10,6 @@ uri = config.get("MongoDB", "mongo_uri") ...@@ -10,3 +10,6 @@ uri = config.get("MongoDB", "mongo_uri")
# FastAPI Port # FastAPI Port
port_no = config.get("FastAPI", "port") port_no = config.get("FastAPI", "port")
# Excel file path
xlsx_path = config.get("Excel_file", "xlsx_path")
import pandas as pd import pandas as pd
from scripts.constants.application_config import xlsx_path
def read_excel_file(): def read_excel_file():
excel_data = pd.read_excel("temp/mongodb_data.xlsx") # Read data from Excel file
excel_data = pd.read_excel(xlsx_path)
print("Data Stored on excel file:\n", excel_data) print("Data Stored on excel file:\n", excel_data)
...@@ -124,7 +124,6 @@ class operations_on_api: ...@@ -124,7 +124,6 @@ class operations_on_api:
ws.cell(row=i + 2, column=j + 1, value=record[key]) ws.cell(row=i + 2, column=j + 1, value=record[key])
# Save the Excel Workbook # Save the Excel Workbook
wb.save("temp/mongodb_data.xlsx") wb.save("temp/mongodb_data.xlsx")
except Exception as e: except Exception as e:
print("Generating Excel file error-", e) print("Generating Excel file error-", e)
# Importing Libraries # Importing Libraries
from fastapi import FastAPI, UploadFile from fastapi import FastAPI, UploadFile
from scripts.constants.endpoints import APIEndpoints from scripts.constants.endpoints import APIEndpoints
from scripts.constants.read_file import read_excel_file from scripts.constants.read_file import read_excel_file
from scripts.core.handlers.api_functions import operations_on_api from scripts.core.handlers.api_functions import operations_on_api
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment