Oracle Apex 19.1 introduced a new feature to load data in CSV, XLSX, XML, and JSON format. In this tutorial, you will learn how to import a CSV file using the new Oracle data loading feature.
Steps To Import CSV File Using Apex 19.1 Data Loading Feature
- Open Oracle Apex and login to your application by providing the Workspace, Schema, and Password information.
- Then click on the menu SQL Workshop > Utilities > Data Workshop as shown in the below image:
- Now click on the Load Data button to import the data from a CSV, XLSX, XML, and JSON file format to Oracle table, as shown in the below image:
- On the next screen, it will ask you to select the file. You can click on the Choose File button to browse and select the file, or you can drag and drop to that area, as shown in the below image:
- After specifying the CSV file, it will take you to the following screen, where you can select the delimiter, enclosing character and the file encoding options. Also, you can select/deselect columns by clicking on the Configure button.
- After specifying the configuration, before clicking on the Load Data button, specify the staging table name to load the data. There is no option in Apex 19.1 to load data into an existing table in Oracle. You need to provide a new table which you can use as a staging table, and after that, you can transfer the data from the staging table to the actual table. Below is the example:
- Now click on the Load Data button to import the CSV file in the specified table. You will get the successful import message as shown below:
Your import is successfully completed, you can verify the data by querying the above table:
SELECT * FROM EMPLOYEES_STAGING;
To transfer data from this staging table to the actual table you can create a stored procedure to validate and import the data or you can run the following command:
INSERT INTO employees SELECT EMPLOYEE_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER, TO_DATE (HIRE_DATE, 'dd/mm/yyyy'), JOB_ID, SALARY, COMMISSION_PCT, MANAGER_ID, DEPARTMENT_ID FROM employees_staging;
I have experienced some issues when I was trying to import the file in Excel (XLSX) format. It was not importing the string columns. I tried to sort out but it did not work. So I saved the XLSX file in CSV format to import.
Maybe you can try also to import in Excel (XLSX) format in Oracle Apex 19.1 and share your experience in the comments section below. Thanks.