Discussions
Categories
- 196.9K All Categories
- 2.2K Data
- 240 Big Data Appliance
- 1.9K Data Science
- 450.4K Databases
- 221.7K General Database Discussions
- 3.8K Java and JavaScript in the Database
- 31 Multilingual Engine
- 550 MySQL Community Space
- 478 NoSQL Database
- 7.9K Oracle Database Express Edition (XE)
- 3K ORDS, SODA & JSON in the Database
- 546 SQLcl
- 4K SQL Developer Data Modeler
- 187.1K SQL & PL/SQL
- 21.3K SQL Developer
- 295.9K Development
- 17 Developer Projects
- 138 Programming Languages
- 292.6K Development Tools
- 107 DevOps
- 3.1K QA/Testing
- 646K Java
- 28 Java Learning Subscription
- 37K Database Connectivity
- 155 Java Community Process
- 105 Java 25
- 22.1K Java APIs
- 138.1K Java Development Tools
- 165.3K Java EE (Java Enterprise Edition)
- 18 Java Essentials
- 160 Java 8 Questions
- 86K Java Programming
- 80 Java Puzzle Ball
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 94.3K Java SE
- 13.8K Java Security
- 204 Java User Groups
- 24 JavaScript - Nashorn
- Programs
- 443 LiveLabs
- 38 Workshops
- 10.2K Software
- 6.7K Berkeley DB Family
- 3.5K JHeadstart
- 5.7K Other Languages
- 2.3K Chinese
- 171 Deutsche Oracle Community
- 1.1K Español
- 1.9K Japanese
- 232 Portuguese
APEX Cloud 20.1 - How to create application to allow users to upload Excel file xslx to a table

I've read in Cloud 20.1 documentation how to upload xlsx file into table by going to Workspace homepage, SQL workshop, Utilities,Data Workshop, Load Data. That works fine, but I think this method is for developers or admins only. I need to create an application that will let a user, not a developer, load their spreadsheet into an existing table, replacing the previous uploaded data. In order to maintain data integrity, having the user save as csv and then upload csv is not an option; it must be the native spreadsheet. When I tried creating a Data Loading page within an application, the wizard only shows support for csv or delimited files, not xlsx.
I was hoping Cloud 20.1 would allow direct xlsx upload by a user, but I cannot find that option. Can anyone give me the options for doing this within 20.1.
Best Answer
-
I would add display only item Px_FILE_NAME for show file name.
Create display only item and add After Submit Computation
- Type: SQL Query (return single row)
- SQL Query:
select f.filename from apex_application_temp_files f where 1 = 1 and f.name = :Px_FILE
Set Server-side Condition to this computation
- Type: Item is NOT NULL
- Item: Px_FILE
Second problem comes because you submit page again, and you don't select file.
This case file browser item session state is set to null.
I would add hidden item Px_NAME that we can use for insert process fetch correct file from apex_application_temp_files.
Create hidden item and add After Submit Computation
- Type: Item
- Item Name: Px_FILE
Set Server-side Condition to this computation
- Type: Item is NOT NULL
- Item: Px_FILE
In above examples Px_FILE is your file browser item.
Now use Px_NAME in your insert process instead of Px_FILE, that is file browser item.
I hope this works
Answers
-
4100203 wrote:I've read in Cloud 20.1 documentation how to upload xlsx file into table by going to Workspace homepage, SQL workshop, Utilities,Data Workshop, Load Data. That works fine, but I think this method is for developers or admins only. I need to create an application that will let a user, not a developer, load their spreadsheet into an existing table, replacing the previous uploaded data. In order to maintain data integrity, having the user save as csv and then upload csv is not an option; it must be the native spreadsheet. When I tried creating a Data Loading page within an application, the wizard only shows support for csv or delimited files, not xlsx.I was hoping Cloud 20.1 would allow direct xlsx upload by a user, but I cannot find that option. Can anyone give me the options for doing this within 20.1.
Check sample application File Upload and Download.
This might also help
-
Thank you jariola. That example in the blog was very helpful. I followed the steps in the blog, and was able to get it working but I had a couple problems I can't seem to get quite right. Hoping you can help me get these two issues resolved.
1) When the file is chosen and the parse button is clicked, the parser results and column information regions populate and/or refresh, but the file browser selection does not show the selected file any longer, so the user does not have any idea what file is being parsed. How to keep that file box filled in, or is it better to just add a text item to show the filename? If the data is being displayed, the filename it came from should be shown as well.
2) I want the user to select the parse button first so they can see the results of their file, then press another button like LOAD to do the actual insert. I added the LOAD button to submit page, then added the PL/SQL code for the insert (same code as at the end of the blog) into an After Submit process. But it seems this only works if I press the LOAD button first, and not the PARSE button first. If I hit the PARSE button first, it seems the LOAD does not enter into the PL/SQL loop, so not data inserted. The PARSE button works repeatedly. I know it has to do with the data not being available after the PARSE button is pressed, but I cannot figure out why, especially since the PARSE button continues to work repeatedly.
-
I would add display only item Px_FILE_NAME for show file name.
Create display only item and add After Submit Computation
- Type: SQL Query (return single row)
- SQL Query:
select f.filename from apex_application_temp_files f where 1 = 1 and f.name = :Px_FILE
Set Server-side Condition to this computation
- Type: Item is NOT NULL
- Item: Px_FILE
Second problem comes because you submit page again, and you don't select file.
This case file browser item session state is set to null.
I would add hidden item Px_NAME that we can use for insert process fetch correct file from apex_application_temp_files.
Create hidden item and add After Submit Computation
- Type: Item
- Item Name: Px_FILE
Set Server-side Condition to this computation
- Type: Item is NOT NULL
- Item: Px_FILE
In above examples Px_FILE is your file browser item.
Now use Px_NAME in your insert process instead of Px_FILE, that is file browser item.
I hope this works
-
Thank you Jariola! Your assistance was spot on. My application is up and running now.