add write excel/insert
This commit is contained in:
34
write_excel_insert.py
Normal file
34
write_excel_insert.py
Normal file
@ -0,0 +1,34 @@
|
||||
import pandas as pd
|
||||
import xlsxwriter
|
||||
import tkinter as tk
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
|
||||
def write_excel_insert(value_insert):
|
||||
today = datetime.now().strftime('%d-%m-%Y_%H-%M')
|
||||
filename = f'Articoli_Inseriti{today}.xlsx'
|
||||
workbook = xlsxwriter.Workbook(filename)
|
||||
worksheet = workbook.add_worksheet()
|
||||
|
||||
worksheet.write('A1', 'CODICE (ART_CODICE)')
|
||||
worksheet.write('B1', 'DESCRIZIONE')
|
||||
worksheet.write('C1', 'UM')
|
||||
worksheet.write('D1', 'COSTO')
|
||||
worksheet.write('E1', 'SC1')
|
||||
worksheet.write('F1', 'SC2')
|
||||
worksheet.write('G1', 'RICARICA')
|
||||
worksheet.write('H1', 'CODICE_ALTERNATIVO')
|
||||
worksheet.write('I1', 'CODICE_BARRE')
|
||||
|
||||
|
||||
for row_index, row_data in enumerate(value_insert):
|
||||
|
||||
for col_index, value in enumerate(row_data):
|
||||
worksheet.write(row_index + 1, col_index, value)
|
||||
|
||||
root = tk.Tk()
|
||||
loading_label = tk.Label(root, text="")
|
||||
loading_label.pack(pady=20)
|
||||
loading_label.config(text="Aggiornamento in corso... Attendere...")
|
||||
workbook.close()
|
||||
Reference in New Issue
Block a user