#!/usr/bin/python

import sqlite3
import openpyxl
import sys
import csv

conn = sqlite3.connect('db.sqlite3')
print ("opened database successfully")

wb = openpyxl.load_workbook('Archaea_analysis.xlsx')
sheet = wb.get_sheet_by_name('Sheet1')


inp = []
temp = []

for rows in range(2, 3686):
	sno = rows-1
	temp.append(sno)
	SwissProtID = sheet.cell(row = rows, column = 1).value
	temp.append(SwissProtID)
	SwissProtAccID =  sheet.cell(row = rows, column = 2).value
	temp.append(SwissProtAccID)
	ProtName = sheet.cell(row = rows, column = 3).value
	temp.append(ProtName)
	Organism = sheet.cell(row = rows, column = 4).value
	temp.append(Organism)
	ProtFunc = sheet.cell(row = rows, column = 5).value
	temp.append(ProtFunc)
	GenAcc_GenID = sheet.cell(row = rows, column = 6).value
	temp.append(GenAcc_GenID)
	ProtAcc_ProtID = sheet.cell(row = rows, column = 7).value
	temp.append(ProtAcc_ProtID)
 	ProtDesc = sheet.cell(row = rows, column = 8).value
	temp.append(ProtDesc)
	Codon = sheet.cell(row = rows, column = 9).value
	temp.append(Codon)
	Start = sheet.cell(row = rows, column = 10).value
	temp.append(Start)
	Stop = sheet.cell(row = rows, column = 11).value
	temp.append(Stop)
	Strand = sheet.cell(row = rows, column = 12).value
	temp.append(Strand)
	MolFunc = sheet.cell(row = rows, column = 13).value
	temp.append(MolFunc)
	BioProc = sheet.cell(row = rows, column = 14).value
	temp.append(BioProc)
	CellComp = sheet.cell(row = rows, column = 15).value
	temp.append(CellComp)
	PDB_ID = sheet.cell(row = rows, column = 16).value
	temp.append(PDB_ID)
	inp.append(temp)
	temp = []

conn.executemany("INSERT INTO ugp_archaeatablenew VALUES (?,?,?, ?, ?, ?, ?, ?, ?, ?, ?,?,?,?,?,?,?)", inp)
conn.commit()

print ("Records created successfully")
conn.close()
