
If you have more than one sheet, and need to insert all the contents of the sheets into the table, then replace the trailing part of the code, after creating table( cursor.execute(create_table)) with the below one : xl = pd.ExcelFile(file) Where also add the case of dropping the TEST table whether it exists( without forgetting to handling with care for dropping a table). You might prefer a direct( without need of loop for each column of each row) and more performant( with use of cursor.executemany function) method along with the data analytics library(pandas) as follows : import pandas as pdĮXECUTE IMMEDIATE('DROP TABLE """+tab_name+"""') INSERT INTO test (col1,col2,col3,col4,col5,col6,col7) # Inserting all the above variables for each column loop #looping through each row for each column Wb = openpyxl.load_workbook('',data_only=True) Print("Database version:", connection.version)

TIA! import openpyxlĬonnection = cx_nnect("", "", "/") I want to load the data as it reads from excel in a loop for every column. I am not sure how can I have 'insert statement' or 'create table' statement as part of this code in Oracle part. Edit: I mean this is just my partial code. I did code few lines to get acquainted as shown below. Is there a way we can read data from excel file and load into Oracle table? Some sample python script would be of great help. Your comments will make me perfect in the future.Newbie here. If you have found any mistake in concept, please do comment. I think the procedure is very clear with snapshots. In the attached example I used a comma separator. Apart from any separators you can use fixed width. In this import I need to choose the separator for the flat file.

You can also import text flat files data. Using the preceding procedure you can easily import Excel data. Step 11 : Commit the Task by clicking on the commit button. Step 10 : Click on Execute to finish the process. Here your Excel data has been bound with the table columns.

The AutoMap button will automatically bind your Excel sheet column data with the Oracle table column. Step 9 : Choose the sheet and click on AutoMap. Step 8 : Now, browse to your Excel file - > Next -> Step 7 : After clicking on Execute Wizard the following screen will open: Now execute the data button to enable the use. Step 5 : Select the table you want to import the Excel data to. Step 4 : Go to Database -> Import -> Table Data.

It's time to create the data in an Excel file.
