import pandas as pd from flask import Flask, request, render_template_string import os app = Flask(__name__) # Directory to store converted CSV files UPLOAD_FOLDER = 'converted_files' os.makedirs(UPLOAD_FOLDER, exist_ok=True) @app.route('/') def index(): return '''
{df}" # Flag to track if tracking number is found in the sheet tracking_found = False # Iterate through every row and column to search for the tracking number for row_idx, row in df.iterrows(): for col_idx, cell in row.items(): # Convert cell to string before searching cell_str = str(cell) # Check if the tracking number exists in the current cell if tracking_no.lower() in cell_str.lower(): tracking_found = True result_html += f"
Tracking No: {tracking_no} found in row {row_idx}, column {col_idx} (value: {cell_str})
" if not tracking_found: result_html += f"No data found for Tracking No: {tracking_no} in sheet: {sheet_name}
" return render_template_string(result_html) except Exception as e: return f"Error processing file: {e}", 500 if __name__ == '__main__': app.run(debug=True, port=5000, host='0.0.0.0')