from openpyxl import load_workbook from dataBaseConnect import ConnecyMyDataBase import time inicio = time.time() print("Lendo o arquivo") wb = load_workbook('/home/ldrf/Downloads/docente_2016.xlsx', read_only=True) print("Lendo as folhas") for sheet_name in wb.sheetnames: print(sheet_name) sheet = wb['Escolas_do_Ceara'] data = "" first_line = "" database = ConnecyMyDataBase() print('Conectando com o banco de dados') database.set_connection('uece', '1', '127.0.0.1', database='EGRESSO') print('Conexao com sucesso') linha = 1 coluna = 1 # for i in range(1, sheet.max_row, 1): # for j in range(0, sheet.max_column, 1): for rows in sheet.iter_rows(min_row=2): for cell in rows: # tmp = sheet.cell(row=i+1, column=j + 1).value tmp = cell.value if tmp is None: tmp = "''" elif type(tmp) is str:
from dataBaseConnect import ConnecyMyDataBase from openpyxl import load_workbook inicio = time.time() print("Lendo o arquivo") wb = load_workbook('/home/ldrf/Projetos/TCC/Planilha/Q eu acho/CSF.xlsx', read_only=True) data = '' print("Lendo as folhas") for sheet_name in wb.sheetnames: print(sheet_name) sheet = wb[wb.sheetnames[0]] data = "" first_line = "" database = ConnecyMyDataBase() print('Conectando com o banco de dados') database.set_connection('uece', '1', '127.0.0.1', database='EGRESSO') print('Conexao com sucesso') linha = 1 coluna = 1 total_coluna = sheet.max_column for rows in sheet.iter_rows(min_row=3): for cell in rows: tmp = cell.value if tmp is None: tmp = "''" elif type(tmp) is str: tmp = '"' + tmp + '"'
from dataBaseConnect import ConnecyMyDataBase from openpyxl import load_workbook inicio = time.time() print("Lendo o arquivo") wb = load_workbook('pathfile', read_only=True) data = '' print("Lendo as folhas") for sheet_name in wb.sheetnames: print(sheet_name) sheet = wb[wb.sheetnames[0]] data = "" first_line = "" database = ConnecyMyDataBase() print('Conectando com o banco de dados') database.set_connection(user, password, host, database=schema) print('Conexao com sucesso') linha = 1 coluna = 1 total_coluna = sheet.max_column - 1 for rows in sheet.iter_rows(min_row=3): for cell in rows: tmp = cell.value if tmp is None: tmp = "''" elif type(tmp) is str: tmp = "'" + tmp + "'"
import time import csv from dataBaseConnect import ConnecyMyDataBase from openpyxl import load_workbook inicio = time.time() print('Conectando com o banco de dados') database = ConnecyMyDataBase() database.set_connection(user, password, host, database=schema print("Lendo o arquivo") linha = 0 with open('pathfile', 'r', encoding="utf-8") as file: reader = csv.reader(file, delimiter = '|') data = next(reader) for data in reader: t = ",".join(str("'" + str(x) + "'") for x in data) database.insert_table_escola(t,linha) linha += 1
from openpyxl import load_workbook from dataBaseConnect import ConnecyMyDataBase import time inicio = time.time() print("Lendo o arquivo") wb = load_workbook('pathfile', read_only=True) print("Lendo as folhas") for sheet_name in wb.sheetnames: print(sheet_name) sheet = wb['Escolas_do_Ceara'] data = "" first_line = "" database = ConnecyMyDataBase() print('Conectando com o banco de dados') database.set_connection(user, password, host, database=schema) print('Conexao com sucesso') linha = 1 coluna = 1 # for i in range(1, sheet.max_row, 1): # for j in range(0, sheet.max_column, 1): for rows in sheet.iter_rows(min_row=2): for cell in rows: # tmp = sheet.cell(row=i+1, column=j + 1).value tmp = cell.value if tmp is None: tmp = "''" elif type(tmp) is str: