본문 바로가기

웹 프로그래밍14

[Flask] 디비 내용 엑셀 다운로드 기능3 axios.get('/download_excel', { responseType: 'blob' }) .then(response => { // 응답으로 받은 파일 데이터 처리 const url = window.URL.createObjectURL(new Blob([response.data])); // 다운로드 링크 생성 및 클릭 const link = document.createElement('a'); link.href = url; link.setAttribute('download', 'data.xlsx'); document.body.appendChild(link); link.click(); link.remove(); }) .catch(error => { console.error(error); }); from.. 2023. 5. 18.
[Flask] 디비 내용 엑셀 다운로드 기능2 from flask import Flask, render_template, make_response import mysql.connector from openpyxl import Workbook app = Flask(__name__) # MariaDB 연결 설정 db = mysql.connector.connect( host="localhost", user="your_username", password="your_password", database="your_database" ) @app.route('/download_excel') def download_excel(): # 쿼리를 실행하여 데이터 가져오기 cursor = db.cursor() query = "SELECT * FROM your_table" .. 2023. 5. 16.
[Flask] 디비 내용 엑셀 다운로드 기능 from flask import Flask, make_response import mysql.connector import pandas as pd app = Flask(__name__) # MariaDB 연결 설정 db = mysql.connector.connect( host="localhost", user="your_username", password="your_password", database="your_database" ) @app.route('/download_excel') def download_excel(): # 쿼리를 실행하여 데이터 가져오기 cursor = db.cursor() query = "SELECT * FROM your_table" cursor.execute(query) resul.. 2023. 5. 16.
[HTML/CSS/JS] 카메라 직접 호출 방법 이미지 파일을 엑세스하는 방법 2023. 3. 22.
[웹프로그래밍] 부모 태그 내 자식 모두 삭제 var row = document.getElementById('table-area'); if (row.childElementCount > 0) { while (row.hasChildNodes()) { row.removeChild(row.firstChild); } } 2022. 9. 2.
[웹프로그래밍] i icon 안불러와짐 해결 두가지 import를 꼭 해줘야 불러와진다. import를 두개 했지만 안불러와지는건.. 그냥 안되는 거 같다.. 2022. 9. 2.