APEX: Read uploaded excel file with as_read_xlsx - excel

As far as I understand, APEX 5.1 does not support Excel files to be loaded into tables.
I found this package that seems to make it possible to SELECT from Excel files, but it does not show how to use it with, for example, files loaded via the "File Browse" Item.
Now, I am very new to this environment, so please explain it from the beginning.
What I did is I upload the package script to the SQL workshop and executed it, without errors. But now?

APEX 5.1 doesn't support it out of the box, but you can use the EXCEL2COLLECTION plugin (available here).
It is very straightforward, just create a file browse page item with an upload button which calls an onsubmit process (e.g. CreateCollection) of type Excel2Collection[Plug In] - specify the file browse item, a collection name and the CSV separator, then you can do as you please with the data (e.g. you may want to run some validations on the data then insert it into a table where you can access it as normal).

Related

Load data from *.xlsx or *.xls to Oracle table from Oracle Apex 4.0.2 User account

I need some help loading data from Excel Files (*.xlsx, *.xls)to Oracle 11 using an Oracle Apex 4.0.2 User Account.
I found and modified a process to load *.cvs files. This process works as follows:
Load the *.csv files into a BLOB column.
After insert into the table, I execute the
This process inserts every row to the table
I want you to help me to code a similar code, but instead of loading *.csv I want it to work with Excel files.
Oracle Apex 4.0.2 has a Workshop to load but it is only allowed to Developers, and I want to create this process in order to allow Users to load data by themselves.
Any reason why you don't upgrade to apex 5.0, or at the very least 4.2? The "Data Loading" components have been added in 4.1 and offer you a fast way of developing this exact requirement. 4.0 is ancient by now and no longer supported.
Loading an xlsx or xls is vastly, vastly different from loading a CSV. Again, I'd ask, why not update. There are plugins available which process excel files to collections, even XLSX. Again though, your apex version is too low. You're shooting yourself in the foot here. Not that there aren't coding options available, but still.
If you still don't want to upgrade for some arbitrary reason, focus perhaps on xlsx files. They're essentially zip-files with a bunch of files. I wrote a blog on this back in 2012. http://tpetrus.blogspot.be/2012/09/a-non-standard-export-to-excel-2010-xlsx.html
It's still relevant and I'm only linking it because it contains all the guts of the code. It's not infallible and has limits though. There's probably other ways, too. Less so for 4.0.
There is a great package developed by Anton Scheffer that allows you to work with xls or xlsx files (once uploaded as blobs) as tables and perform query operations like:
-- every sheet and every cell
select *
from table( as_read_xlsx.read( as_read_xlsx.file2blob( 'DOC', 'Book1.xlsx' ) ) )
--
-- cell A3 from the first and the second sheet
select *
from table( as_read_xlsx.read( as_read_xlsx.file2blob( 'DOC', 'Book1.xlsx' ), '1:2', 'A3' ) )
--
-- every cell from the sheet with the name "Sheet3"
select *
from table( as_read_xlsx.read( as_read_xlsx.file2blob( 'DOC', 'Book1.xlsx' ), 'Sheet3' ) )
Then you could use the data as needed.
Here's the code.
Yes. someday's ago I done something like this.
I was upload some Excel Files (*.xlsx, *.xls) in oracle database table using oracle apex by a Apex plugin call "Excel2collection".
Actually first I was load the excel file into apex collection table then I move it from collection to oracle database.
Here I provide a link of my blog where I write the full process step by step.
Link: qaiumer.blogspot.com
Excel2Collection plugin is hard to beat. That's Anton's solution bundled into an APEX plugin. This way you can feed the file browse item into a process and have it spit out APEX Collection records
Demo:
https://apex.oracle.com/pls/apex/f?p=52007:6:::NO:::
Plugin:
http://www.apex-plugin.com/oracle-apex-plugins/process-type-plugin/excel2collections_271.html

How to get data from Sharepoint excel datasource to Power BI desktop?

I want to load an excel which is in Share point to Power Bi Desktop.
I have tried loading the sheet by using the data source SharePoint List but failed as its throwing an error. Please help me by suggesting any other way.
Thank you.
I would use Get Data / Web. It will automatically recognize that the target is an Excel file and generate the M functions to interpret it.
The trick can be getting the true link to the SharePoint file - something you can just paste into a browser's address bar so it will download the file directly.
For SharePoint Online, I use Get a Link / Restricted Link, then delete any trailing query parameters after the file name, typically ?d=blabla
That should also work for SharePoint 2016. From memory it was easier in the earlier versions.
I suggest choosing Sharepoint Folder from the Get Data menu.
Then you need to enter the site's (or subsite) root url (not the direct link to the excel file)
For example, you would connect to.
https://yourcompany.sharepoint.com/training/
Instead of the full address.
https://yourcompany.sharepoint.com/:x:/r/training/_layouts/19/Doc.aspx?sourcedoc=%2asdfasdfasdfasdf%7D&action=default&uid=%7asdfasdfasdf-4662-A7A5-asdfasdf%7D&ListItemId=2&ListId=%7asdfasdfasdfa3443445&env=prod
Then press Edit to reveal all of the documents stored at that root. By clicking the binary link, the query editor will reveal the contents of the file. Then select the tab you're interested in loading by selecting the Table under the data column.
Steps to get the data from sharepoint to Power BI:
Select the File available to share pont
Click on three dots
Go to Open-> Open in app
In app, click on File -> Info -> Copy Path
Open Power BI, New Source-> Web
Add URL, delete (data with and after ?)

Make Infragistics UltraGrid Document Exporter launch file

We have an existing application that allows exporting of an Infragistics data grid to either Excel or PDF format. Currently, when the user clicks on the Export button, it asks them where to save the file and then it exports it and saves it. Then, to launch it, they go to where they saved it and then it launches.
The user wants the application to instead launch the grid into either Adobe Acrobat or Excel and THEN that is where the user can opt to save the file. They don't want it to ask where you wish to save it before it exports, like it currently is doing now.
Is this possible with the Infragistics Document Exporter? I couldn't find any information on this from the Infragistics web site.
I'm thinking, instead of giving it a filename, I could instead use a stream maybe to the console or something like that and let the OS give the user the option to launch it?
Is there an example somewhere of this being done? I see there is an overload in the Export member function that allows you to pass in a stream.
Thanks!.
The Infragistics excel engine and documents engine will need to write to a file to be able to have the file opened in Excel or Adobe Acrobat so you will still need to save a file before they can open it.
For the requirement to open the file, you could use System.Diagnostics.Process.Start method and if there is a program associated with the file type you can pass the file that you just saved.
As there is a dependency on the file system to open the file in Excel or Adobe Acrobat you will not be able to achieve your goal of not requiring the file be saved first. While it may be an option to save the file in a temporary location and then open that file it also has an issue that if the user were to click save in excel it would still save in the temporary location so they would need to know to use Save As to save in a different location.

Exporting data to existing Excel file

I have a system with an Excel spreadsheet template file which is used for invoicing. I would like the user to be able to click a button on an Xpage, which will then open the spreadsheet and enter the latest invoicing data in Excel. I don't mind if Excel is either the application on their machine or on the server, but my preference would be the application locally on their machine.
I've looked into Xagents, as I feel this is probably the answer. I know they can be used to create Excel but I have not been able to locate any mention of opening an Excel file, and entering data into specific cells.
Is this possible?
EDIT: you can use Apache POI for editing and creating Microsoft Office documents. This is a java project which gives you a handle to office documents and this can be used using java.
A good starting point can be the blog of Christian Guedemann from webgate:
http://guedebyte.wordpress.com/2012/09/17/documents-and-spreadsheets-with-xpages-building-the-kernel-part-ii/
(end of edit)
The only way I KNOW and tried to write data from Notes to Excel is exporting the data to an HTML page and setting the Content Type accordingly (e. g. as described here (there are a lot more resources available for taht):
http://www.dominoguru.com/pages/developer2010_xpagexlsexport.html
I am not sure if this is of help but it seems that this project can help you:
http://www.openntf.org/internal/home.nsf/project.xsp?action=openDocument&name=ZK%20Spreadsheet%20for%20XPages
As far as I can see this project can load Excel files from XPages - and then it should also be possible to edit the files.
Besides that the only solution I can think of is a Notes Agent that is called from the XPage. This agent can then run in background and do all the excel stuff. After running, the XPage can show a link to the Excel file. Actually this is the solution I would consider to implement - but maybe others step in with better answers here.
You don't want to introduce a dependency on Excel in your application -- wouldn't work with an iPad front-end. Rather have a look at the ZK Spreadsheet, it will fulfill your needs.
However if you have to have Excel, then you need a roundtrip solution: load the Excel from an URL (probably generated by an XAgent (?) and save it back. The saving back part is the tricky one. Normal HTTP doesn't allow that. What you need there is a webDAV capable server. Watch out for a project on OpenNTF soon (just clearing IBM legal) that provides webDAV.
However the ZK Spreadsheet looks much better for your needs.
I have a sample database at the following URL --> http://www.nnsu.com/nnsusite.nsf/%24%24OpenDominoDocument.xsp?documentId=B65507CB2DE15B3286257986005F061D&action=openDocument
Download the APCC.nsf. This will allow you to create/read a new EXCEL spreadsheet and then stream the resulting file to the requesting browser. There is not need to have EXCEL or office installed on the Server.
THe examples create a new workbook, but you can also store a "template" on the server or in a notes document and use it as a starting point and then save it to a document or stream it to the requesting browser.
With Apache POI you can read/write to a spreadsheet using data from the notes document the process is initiated from.

Possible to create thumbnails of MS Office files?

Have anybody ever tried to create thumbnails/previews of MS Office files? I do not mean extract saved preview images inside the file, but actually create them. Would this even be doable?
Could one print to an image/pdf directly in code?
In a general VB/C# application, add the MSword/MSexcel component and call the component to open the file you want. Then call one of the print functions with the parameters corresponding to first page etc.
This link shows how to open a .xls from C#

Resources