How to download a csv/excel file stored in a server using OA Framwork

Hi All,
We have a requirement where we have to generate a CSV file using PL/SQL block and the user shoul download that csv file to his client machine whenever it requirs to him. We have generated csv file and save the same in a particular location in the server. As the CSV file size may be around 10 to 15 MB we feel the storing and retrieving of the csv file in a BLOB object is a performance hit. Now we want to dowload the file from the csv file path without storing the csv file into database BLOB object.
Is this possible using OA framwork? if so please guide me how to do this.
Thanks in advance.
Regards,
Sathesh.

If u know following details you can use below method to download any file ( XLS/any) its generic method I have used in one of my project-
1. File Name with Extension
2. File path at which it has been placed
3. Page Context (you must know i assume)
public void DownloadFileFromServer(OAPageContext pgeContext, String file_name_with_path,
String file_name_with_ext)
System.out.println("Filename path "+file_name_with_path + "File Name:" + file_name_with_ext);
HttpServletResponse responseVar = (HttpServletResponse)pageContext.getRenderingContext().getServletResponse();
if (((file_name_with_path == null) || ("".equals(file_name_with_path))))
System.out.println("File path is invalid.");
File fileToDwnld = null;
try
fileToDwnld = new File(file_name_with_path);
catch (Exception e)
System.out.println("Invalid File Path or file does not exist.");
if (!fileToDwnld.exists())
System.out.println("File does not exist.");
if (!fileToDwnld.canRead())
System.out.println("Not Able to read the file.");
String MADfileType = getMADMimeType(file_name_with_ext);
System.out.println("File Type - " + MADfileType);
responseVar.setContentType(MADfileType);
responseVar.setContentLength((int)fileToDwnld.length());
System.out.println("File Size is " + fileToDwnld.length());
responseVar.setHeader("Content-Disposition", "attachment; filename=\"" + file_name_with_ext + "\"");
InputStream inStr = null;
ServletOutputStream outStr = null;
try
outStr = responseVar.getOutputStream();
inStr = new BufferedInputStream(new FileInputStream(fileToDwnld));
int ch;
while ((ch = inStr.read()) != -1)
outStr.write(ch);
catch (IOException e)
e.printStackTrace();
finally
try
outStr.flush();
outStr.close();
if (inStr != null)
inStr.close();
catch (Exception e)
e.printStackTrace();
Edited by: aprak on Oct 18, 2011 1:08 AM
Edited by: aprak on Oct 18, 2011 1:09 AM

Similar Messages

  • How can one  read a Excel File and Upload into Table using Pl/SQL Code.

    How can one read a Excel File and Upload into Table using Pl/SQL Code.
    1. Excel File is on My PC.
    2. And I want to write a Stored Procedure or Package to do that.
    3. DataBase is on Other Server. Client-Server Environment.
    4. I am Using Toad or PlSql developer tool.

    If you would like to create a package/procedure in order to solve this problem consider using the UTL_FILE in built package, here are a few steps to get you going:
    1. Get your DBA to create directory object in oracle using the following command:
    create directory TEST_DIR as ‘directory_path’;
    Note: This directory is on the server.
    2. Grant read,write on directory directory_object_name to username;
    You can find out the directory_object_name value from dba_directories view if you are using the system user account.
    3. Logon as the user as mentioned above.
    Sample code read plain text file code, you can modify this code to suit your need (i.e. read a csv file)
    function getData(p_filename in varchar2,
    p_filepath in varchar2
    ) RETURN VARCHAR2 is
    input_file utl_file.file_type;
    --declare a buffer to read text data
    input_buffer varchar2(4000);
    begin
    --using the UTL_FILE in built package
    input_file := utl_file.fopen(p_filepath, p_filename, 'R');
    utl_file.get_line(input_file, input_buffer);
    --debug
    --dbms_output.put_line(input_buffer);
    utl_file.fclose(input_file);
    --return data
    return input_buffer;
    end;
    Hope this helps.

  • Parameter in WEBADI How to Download the WebADI Excel File with Parameter

    Experts, How to Download the Oracle Web ADI Excel File followed by entering Parameters which means the spread sheet should display the data dynamically based on the parameter provided by the end user. Can anybody share any hint or idea? Regards, Gaurav Nagpal.

    Can anybody help me please!

  • Oracle WebADI: How to Download the WebADI Excel File with Parameter

    Hello Friends,
    How to Download the Oracle WebADI Excel File with Parameter??
    For Ex: How to download the Employees for Specific Department from Oracle WebADI.
    And After to change the specific changes on Employee Data to Upload.
    Thanks in Advance.

    Hi Team.
    Any Advise on it!!

  • How can i find an excel file deleted from the server

    In our office we all have access to the main server. Recently a document that we need was deleted from the server. It's not in the trash. Can and how would we be able to find and recover this deleted document? Specifically I am looking for an excel document, and I already checked the recent docs on excel.
    thanks!

    Have the admin for the server restore the file from the backup

  • How can I create an csv/excel file using pl/sql and then sending that file

    How can I create an csv/excel file using pl/sql and then sending that file to a clients site using pl/sql?
    I know how to create the csv/excel file but I can't figure out how I would get it to the clients site.

    968776 wrote:
    How can I create an csv/excel file using pl/sql and then sending that file to a clients site using pl/sql?
    I know how to create the csv/excel file but I can't figure out how I would get it to the clients site.You are trying to do it at a wrong place..
    Whay do you want database (pl/sql) code to do these things?
    Anyhow, you may be interested in :
    {message:id=9360007}
    {message:id=9984244}

  • Download/Display the image files stored at KM location: J2EE application

    Hi All
    Please let me know how to download/Display the image files stored at KM location on portal using J2EE application. Thanks.
    Best Regards
    P M

    You can use a servlet to deliver the image data to the <img tag, which allows you to get the data from something other than a file on the server (e.g. store the image data as a session attribute with a generated attribute key, the key being given in the serlvet's query string).

  • How to Read data from excel file without converting a excel file into .csv or any other format

    Hello,
    Can somebody suggest me how to read from an excel file (consisting of 10 work sheets) to an array?
    Thanks,
    She

    You have to be careful when using the spreadsheet-files vi's.  They are located in the Functions Palette under File IO, you will find "Write To / Read From Spreadsheet File.vi"s. 
    Here is what the Context Help says about the vi function:
    "Reads a specified number of lines or rows from a numeric text file beginning at a specified character offset and converts the data to a 2D, single-precision array of numbers. You optionally can transpose the array. The VI opens the file before reading from it and closes it afterwards. You can use this VI to read a spreadsheet file saved in text format. This VI calls the Spreadsheet String to Array function to convert the data. "
    This is quick & easy when the spreadsheet is all the same format.  You can set the format to string as well.  HOWEVER...  you do have to convert the Excel spreadsheet to text before using it.
    I haven't experimented with the Active-X, but it may look as the way to go if you have combination text / numeric values in the spreadsheet.
    If you did convert it to text, then you can use array functions as well and treating the file as an array of strings (see very brief example attached).  The example is to illustrate a point only  
    JLV
    Attachments:
    starting point for spreadsheet.vi ‏28 KB

  • Upload and download of  excel file in the application server in background

    Hi all,
    i want to download the excel file from application server into internal table and after processing i have to upload to excel file in the application server in the background mode..
    i mean i'll schedule the program in background.
    im using FM ALSM_EXCEL_TO_INTERNAL_TABLE its working fine in fore ground but not in back ground.
    what method i have to follow ?

    Hi Ankit,
    I think this is not possible to open a Excel-File from the application server because the Excel format before Office 2007 where a binary format (Suffix: .xls). The newer Office file format (Suffix: xlsx) is a zipped XML Format. To read the binary Excel-Format you need an OLE Connection between SAP GUI and Office. But at the application server in background you doesn't have this OLE Connection.
    In my opinion you have two possibilities:
    1. Convert all files in the CSV format. This file format can be read with open dataset.
    2. Upload the files from the presentation server in forground. There are some funktion modules in the standard which can read the xls format. But they have some limits regarding the length of cells content.
    My recommendation is solution no. 1. If you know an VBA expert, he can write an Excel-macro which converts all Excel Files in the CSV-Fomat.
    Regards
    Dirk

  • Best ways to view/display PDF/Excel files stored in the Database

    What are best ways to display/view PDF/Excel files stored in the Database? thanks L

    Thanks tom, sorry let me explain. Currently we have oracle forms screen, using webutil to store/view files into DB. client won't like the interface, they want us to make it more friendly, drag and drop if possible, load multiple files, as possible.. So I am exploring different ways to improve may be java (or jdev/any any other), different screen designs, different features for fileupload/download/view options.

  • How do I produce an excel file using java code

    How do i produce an excel file using java code.
    If it is possible would ne one have ne source code as an example.
    I have tried looking up information on outputing the information to a *.csv file but unfortunality i have had no luck in finding any information. To be exact ne source code.
    Thanks
    Lee

    That's what I use and I'd be the first to admit that it's very messy. But it works. Go use Google and see what else you can find.

  • How do I save a excel file to be compatible...

    How do I save a excel file from a pc to be compatible with my Mac?

    Hi juicebars,
    iWork is a productivity suite for Macs running OS or iThings running iOS. With a MacBook Pro you will need the OS version.
    iWork consists of:
    Pages, a word processor and page layout app (page layout mimics a drawing app). Pages can import Microsoft Word documents and you can edit and save them. Also Export as MS Word, PDF, plain text, RTF or ePub.
    Numbers, a spreadsheet app that mimics a database. Numbers can import Microsoft Excel or CSV documents and you can edit and save them. Also Export as MS Excel, CSV or PDF.
    Keynote, a presentation app. Keynote can open Microsoft Powerpoint. I don't use Keynote, so I can say no more.
    You can buy the iWork suite from the App Store, or buy Pages, Numbers and Keynote separately.
    There are some minor conversion glitches when converting between MS Office and iWork. If you are continually converting, it is best to buy Office or LibreOffice for Mac.
    iWork does not take kindly to huge documents.
    However, I find that Numbers and Pages for Mac OS to have a sweetly intuitive way of doing what I want.
    Regards,
    Ian.

  • Downloading report in excel file

    When I download reoprt in excel file then if material no is 0002134 then in the excel file this becomes 2134,
    I am saving file from the Menu System->Save-> Local fiie and then selecting spreadsheet.
    When I save as text file then it is not removing leading zeros, only in excel file it is removing leading zeros.
    I wanted to know that how to download in excel file so that my material no should download as it is .
    Thanks
    APrasad

    Menu System->Save-> Local fiie and then selecting spreadsheet.
    Spreadsheet is not EXCEL. It is a an internal format.
    if you enter xls as extension, then you just tell Microsoft to open this file with excel.
    Excel then automatically coverts it to its own rules.
    When download with Menu System->Save-> Local fiie and then selecting spreadsheet enter the file extension txt
    Then open Excel, use file > open
    find your file and open it, Excel will come up with an import assistant.
    there you can define if the column is to be loaded as numbers or text.

  • Access Word and Excel files stored on 8820 SD Card?

    Need to be able to access many Word and Excel files stored on an 8820 SSD card - Media Center does not have a category for "business files" only pics and video etc. Is there a way to do that like Documents to Go on the Palm systems? Roxio's filters do not allow Word and Excel files either but Mass Storage accepts the OK. How to access on the SSD card?

    On Android OS 4.1 - 4.3 (Jelly Bean) or older, Adobe Reader for Android version 11.2.x has a known defect in the "All PDFs" view. The All PDFs view does not show the files and folders on an external SD card. A workaround is to use the Folder View instead of the All PDFs view. We have fixed the defect and plan to include the fix in the next release of Reader for Android.
    On Android OS 4.4 (KitKat) only, neither All PDFs view nor Folder View shows any files or folders on an external SD card.  Reader cannot save any changes to the files on an external SD card, either.  We are still working on fixing the problems.  In the meantime, please copy the files from your external SD card to your device's internal storage (e.g. /storage/emulated/0/Documents/...) using a File Manager/Browser app or use a cloud storage service (Acrobat.com, Dropbox, Google Drive, etc.) to store files.
    Your case is the latter because your Samsung Galaxy S4 phone is running 4.4.2 (KitKat).
    Sorry for the inconvenience.

  • How can i display a excel file generated by labview?

    hello,
    I'm looking for an exemple to display (open) a .xls file generated by labview after simulation but without use  the tookit report generation.
    somebody knows how could I do this?
    Any suggestions?
    Thanks,
    longar
    p.s: i use labview 8.6 
    Solved!
    Go to Solution.

    There is quite large dedicated Excel thread with a lot of examples.
    I'm curious though. If you don't have the toolkit, how did you create the Excel file in the first place?

Maybe you are looking for