How to let php code out excel file ?

for example below shows:
<?php
$conn = oci_connect("apps","apps","prod") or die("Connect failure");
$sql = "select h.order_number,to_char(h.ordered_date,'YYYY-MM-DD HH24:MI')
from oe_order_headers_all h
where h.org_id = 82
and to_char(h.ordered_date,'YYYYMMDD') = '20061025'";
$result = oci_parse($conn,$sql);
oci_execute($result);
?>
<table border=1>
<tr>
<td>ordernum</td>
<td>orderdate</td>
</tr>
<?php
while ($rows = oci_fetch_array($result,OCI_BOTH)) {
echo "<tr>";
echo "<td>$rows[0]</td>";
echo "<td>$rows[1]</td>";
?>
</table>
</html>
how to make above example outputs in excel form?
who can help me?
thanks!

<?php
while ($rows = oci_fetch_array($result,OCI_BOTH)) {
print "{$rows[0]};{$rows[1]\n";
?>
Name the file .csv and there you go. If there's a possibility of $rows[i] containing semi-colon don't forget about escaping it or replacing with another separator.

Similar Messages

  • 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}

  • How to read the data from Excel file and Store in XML file using java

    Hi All,
    I got a problem with Excel file.
    My problem is how to read the data from Excel file and Store in XML file using java excel api.
    For getting the data from Excel file what are all the steps i need to follow to get the correct result.
    Any body can send me the code (with java code ,Excel sheet) to this mail id : [email protected]
    Thanks & Regards,
    Sreenu,
    [email protected],
    india,

    If you want someone to do your work, please have the courtesy to provide payment.
    http://www.rentacoder.com

  • HOW TO DOWNLOAD SAP OUTPUT TO EXCEL FILE

    Hi SAP Gurus,
        I would like to ask if you have any Function Module or codes on how to download SAP Output into Excel file. Thanks! Hope you could help me.

    You can transfer the contents of internal table to excel using this code..
    data: begin of itab occurs 0,
          vbeln like vbak-vbeln,
          posnr like vbap-posnr,
          end of itab.
    select vbeln
           posnr
           from vbap
           up to 20 rows
           into table itab.
    * EXCEL sheet using OLE automation.
    INCLUDE OLE2INCL.
    * handles for OLE objects
    DATA: H_EXCEL TYPE OLE2_OBJECT,        " Excel object
          H_WORK  TYPE OLE2_OBJECT,
          H_SHEET TYPE OLE2_OBJECT,
          H_CELL  TYPE OLE2_OBJECT,
          V_COL   LIKE SY-TABIX.     " column number of the cell
    DATA:
      V_STEP(30),
      V_FILE LIKE RLGRAP-FILENAME.
    * tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
    *           PERCENTAGE = 0
               TEXT       = 'Creating Excel...'
           EXCEPTIONS
                OTHERS     = 1.
    * start Excel
      V_STEP = 'Starting Excel'.
      CREATE OBJECT H_EXCEL 'EXCEL.APPLICATION'.
      PERFORM ERR_HDL.
      SET PROPERTY OF H_EXCEL  'Visible' = 1.
    *  CALL METHOD OF H_EXCEL 'OPEN' EXPORTING  #1 = 'C:DMC_REC.XLS'.
    *  PERFORM ERR_HDL.
    * tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
    *           PERCENTAGE = 0
               TEXT       = 'Adding Data to Excel...'
           EXCEPTIONS
                OTHERS     = 1.
    * Get the list of workbooks
      V_STEP = 'Preaparing Excel'.
      CALL METHOD OF H_EXCEL 'WORKBOOKS' = H_WORK.
      PERFORM ERR_HDL.
    ** Add new workbook (create a file)
      CALL METHOD OF H_WORK 'ADD'.
      PERFORM ERR_HDL.
    * Get the created worksheet
    ************************Sheet Number
      CALL METHOD OF H_EXCEL 'WORKSHEETS' = H_SHEET EXPORTING #1 = 3.
    ************************Sheet Number
      PERFORM ERR_HDL.
    * Activate (select) the first sheet
      CALL METHOD OF H_SHEET 'ACTIVATE'.
      PERFORM ERR_HDL.
    * tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
    *           PERCENTAGE = 0
               TEXT       = 'Adding Data to Excel...'
           EXCEPTIONS
                OTHERS     = 1.
    * output column headings to active Excel sheet
      V_STEP = 'Adding data to Excel'.
      LOOP AT ITAB.
        V_COL = SY-TABIX.
        PERFORM FILL_CELL USING 1 V_COL ITAB-vbeln.
        PERFORM FILL_CELL USING 2 V_COL ITAB-posnr.
      ENDLOOP.
      V_STEP = 'Releasing Excel'.
      FREE OBJECT H_EXCEL.
      PERFORM ERR_HDL.
      H_EXCEL-HANDLE = -1.
    *&      Form  ERR_HDL
    *       text
    *  -->  p1        text
    FORM ERR_HDL.
      IF SY-SUBRC <> 0.
        WRITE: / 'Error in processing Excel File:', V_STEP.
        STOP.
      ENDIF.
    ENDFORM.                    " ERR_HDL
    *&      Form  FILL_CELL
    *       text
    *      -->P_1      text
    *      -->P_1      text
    *      -->P_1      text
    FORM FILL_CELL USING  ROW COL VAL.
      CALL METHOD OF H_EXCEL 'Cells' = H_CELL
                     EXPORTING #1 = ROW #2 = COL.
      PERFORM ERR_HDL.
      SET PROPERTY OF H_CELL 'Value' = VAL .
      PERFORM ERR_HDL.
    ENDFORM.                    " FILL_CELL

  • How to retrieve data from an Excel file which is located on server

    hi everybody,
                    I am using SAP NWDS 2004s .     
                I have done an application on how to export the table data into an Excel .
    Now i want to get the data from an Excel file which is located in server and display that data which is in excel in a View for example a Sample view in Webdynpro  .
    In Sample view i took a uielement textview to display the data ....   
    can any one help how to procced further
    Thanks in advance
    Madhavi

    Options to read Excel data to WebDynpro context
    Reading Excel Sheet from Java without using any Framework
    Reading Multiple Sheets of Excel Sheet from Java
    Few Threads
    How to Display the content of Excel file into Webdynpro Table
    Is it possible to upload data from excel file(.xls)
    Re: How to export the data as integer into excel sheet?
    regards
       Vinod

  • How to Load the data from excel file(Extension is .CSV) into the temp.table

    Hi
    How to Load the data from excel file(Extension is .CSV) into the temporary table of oracle in Forms11g.
    My Forms Version is - Forms [64 Bit] Version 11.1.2.0.0 (Production)
    Kindly Suggest the Solution.
    Regards,
    Sachin

    Hello Sachin,
    You can use the following metalink note:How to Read Data from an EXCEL Spreadsheet into a Form Using Webutil Client_OLE2 (Doc ID 813535.1) and modify it a little bit.
    Instead of copy values into forms you can save them in your temporary table.
    Kind regards,
    Alex
    If someone's helpful or correct please mark it accordingly.

  • How to load the data from excel file into temprory table in Forms 11g?

    Hi
    How to Load the data from excel file(Extension is .CSV) into the temporary table of oracle in Forms11g.
    My Forms Version is - Forms [64 Bit] Version 11.1.2.0.0 (Production)
    Kindly Suggest the Solution.
    Regards,
    Sachin

    Declare
        v_full_filename         varchar2(500);
        v_server_path           varchar2(2000);
        v_separator             VARCHAR2(1);
        v_filename              VARCHAR2(400);
        filename                VARCHAR2 (100);
        v_stop_load             varchar2 (2000);
        v_rec_error_log         varchar2(4000);
        v_error_log             varchar2(4000);
        ctr                     NUMBER (12);
        cols                    NUMBER (2);
        btn                     number;
        RES                     BOOLEAN;   
        application             ole2.obj_type;
        workbooks               ole2.obj_type;
        workbook                ole2.obj_type;
        worksheets              ole2.obj_type;
        worksheet               ole2.obj_type;
        cell                    ole2.obj_type;
        cellType                ole2.OBJ_TYPE;
        args                    ole2.obj_type;
        PROCEDURE olearg
        IS
        args   ole2.obj_type;
        BEGIN
        args := ole2.create_arglist;
        ole2.add_arg (args, ctr);                                
        ole2.add_arg (args, cols);                                   
        cell := ole2.get_obj_property (worksheet, 'Cells', args);
        ole2.destroy_arglist (args);
        END;
    BEGIN
    v_full_filename := client_get_file_name(directory_name => null
                                     ,file_name      => null
                                     ,file_filter    => 'Excel  files (*.xls)|*.xls|'  
                                                                            ||'Excel  files (*.xlsx)|*.xlsx|'                                                                 
                                     ,message        => 'Choose Excel file'
                                     ,dialog_type    => null
                                     ,select_file    => null
    If v_full_filename is not null Then
    v_separator := WEBUTIL_CLIENTINFO.Get_file_Separator ;
    v_filename := v_separator||v_full_filename ;
    :LOAD_FILE_NAME := substr(v_filename,instr(v_filename,v_separator,-1) + 1);                                
    RES := Webutil_File_Transfer.Client_To_AS(v_full_filename,"server_path"||substr(v_filename,instr(v_filename,v_separator,-1) + 1));     
    --Begin load data from EXCEL
    BEGIN
        filename := v_server_path||substr(v_filename,instr(v_filename,v_separator,-1) + 1); -- to pick the file
        application := ole2.create_obj ('Excel.Application');
        ole2.set_property (application, 'Visible', 'false');
        workbooks := ole2.get_obj_property (application, 'Workbooks');
        args := ole2.create_arglist;
        ole2.add_arg (args, filename); -- file path and name
        workbook := ole2.get_obj_property(workbooks,'Open',args);
        ole2.destroy_arglist (args);
        args := ole2.create_arglist;
        ole2.add_arg (args, 'Sheet1');
        worksheet := ole2.get_obj_property (workbook, 'Worksheets', args);
        ole2.destroy_arglist (args);
        ctr := 2;                                                     --row number
        cols := 1;                                                -- column number
        go_block('xxx');
        FIRST_RECORD;  
        LOOP       
                --Column 1 VALUE --------------------------------------------------------------------
            olearg;
            v_stop_load := ole2.get_char_property (cell, 'Text'); --cell value of the argument
            :item1 := v_stop_load;
            cols := cols + 1;                                                      
              --Column 2 VALUE --------------------------------------------------------------------
            olearg;
            :item2 := ole2.get_char_property (cell, 'Text'); --cell value of the argument
            cols := cols + 1;
            --<and so on>
        ole2.invoke (application, 'Quit');
        ole2.RELEASE_OBJ (cell);
        ole2.RELEASE_OBJ (worksheet);
        ole2.RELEASE_OBJ (worksheets);
        ole2.RELEASE_OBJ (workbook);
        ole2.RELEASE_OBJ (workbooks);
        ole2.RELEASE_OBJ (application);
    END;
    --End load data from EXCELPlease mark it as answered if you helped.

  • How  to load the data from excel  file  into table in oracle using UTL_FI

    How to load the data from excel file into table in oracle
    and from table to excel file
    using UTL_FILE package
    Please give me some example

    This is something i tried in oracle apex
    http://avdeo.com/2008/05/21/uploading-excel-sheet-using-oracle-application-express-apex/
    Regards,
    CKLP

  • How to save Android contacts as Excel file on Mac computer?

    I want to manage and edit my contacts on my cell phone, my friend suggested me save them as Excel format! So now i am trying this way, but i can't find the right method to do this! Do you know how to save Android contacts as Excel file on Mac computer?

    If you want to save Android Phone contacts to Excel format, you can have a try the following method:
    Step 1. Connect Your Android Phone to Computer
    After downloading and installing the Coolmuster Android Assistant software on your computer, launch it and you will get the program interface prompts you to connect your phone to the computer. Just use a USB cable to connect your phone to the computer and the program will detect the connected phone automatically. If it is the first time to run this software, you may encounter the following picture and be required to enable USB debugging on your phone at first. If your device can be detected by the program, you can directly skip to the next step.
    Step 2: Go to the Contacts windows
    All your phone data are categorized on the top menu. To transfer Android phone's contacts, you can go to click the "Contacts" icon to enter the Contacts window. Navigate to the left panel and click on the "All Contacts" option, then, all the contacts in your phone will show in list on the right window. Mark the contacts you want to backup on your computer and click the button of "Backup".
    Step 3. Start to export contacts to computer at once
    Once you click on the "Backup" button, there will be a "Path" dialog appears, asking you to choose an output location where you want to save the exported contacts. Specify an output folder and then click the "Ok" button. Then, all your phone contacts will be exported to the output location immediately, with all the email address, company's name, home address, and more contacts info perfectly kept in the output CSV or XLS file.

  • How should we get the out put file-name same as in put file-name in file to

    Hi frnds,
    having hundreds of files in the sender system with different names, how should we get the out put file-name  in the receiver system same as the in put file-name in file to file scenario ?
    Thanks in advance.
    truly,
    snrvakiti.

    Hi,
    In Receiver File Adapter you can set under 'Adapter-Specific Message Properties'
    check Use Adapter-Specific Message Properties
    check Fail on Missing Adapter Message Properties
    Check File Name
    Have a look at this link,  [File_to_File|http://allsapnetweavernotes.blogspot.com/2008/09/how-can-i-access-filename-from-fileftp.html]
    Regards,
    P.Rajesh

  • How to save query result in excel file

    Hi all,
    How to save query result in excel file from sql*plus tool.
    thank you

    Do you really need an Excel file (binary) or a simple CSV?
    If you just need a CSV then search for DUMP_CSV at http://asktom.oracle.com or at this forum
    If you need formatting and/or multiple worksheets then you can use free tools like
    https://xml-spreadsheet.samplecode.oracle.com/ or https://exceldocumenttype.samplecode.oracle.com/
    Regards
    Marcus

  • How to read data from the excel file using java code.

    Hi to all,
    I am using below code to getting the data from the excel file but I can't get the corresponding data from the specific file. can anyone give me the correct code to do that... I will waiting for your usefull reply......
    advance thanks....
    import java.io.*;
    import java.sql.*;
        public class sample{
                 public static void main(String[] args){
                      Connection connection = null;
                          try{
                               Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                               Connection con = DriverManager.getConnection( "jdbc:odbc:Mydsn","","" );
                               Statement st = con.createStatement();
                               ResultSet rs = st.executeQuery( "Select * from [Sheet1$]" );
                               System.out.println("sample:"+rs);
                                  ResultSetMetaData rsmd = rs.getMetaData();
                                  System.out.println("samplersd:"+rsmd);
                               int numberOfColumns = rsmd.getColumnCount();
                                  System.out.println("numberOfColumns:"+numberOfColumns);
                                   while (rs.next()) {
                                            System.out.println("sample1:"+rs);
                                            for (int i = 1; i <= numberOfColumns; i++) {
                                                 if (i > 1) System.out.print(", ");
                                                 String columnValue = rs.getString(i);
                                                 System.out.print(columnValue);
                                            System.out.println("");
                                       st.close();
                                       con.close();
                                      } catch(Exception ex) {
                                           System.err.print("Exception: ");
                                           System.err.println(ex.getMessage());
                        }

    1: What is the name of the excel sheet?
    2: What is printed in this program? null ? anything?
    error?Excel file name is "sample.xls" I set excel file connectivity in my JDBC driver(DSN). Here in my program I am not giving that excel file name. I am giving only that excel sheet name. that is followed
    ResultSet rs = st.executeQuery( "Select * from [Sheet1$]" );The output of this program is given bellow.
    sample:sun.jdbc.odbc.JdbcOdbcResultSet@1b67f74
    samplersd:sun.jdbc.odbc.JdbcOdbcResultSetMetaData@530daa
    numberOfColumns:2

  • How to get html code out of psd file????

    Hi, I have PS CS6, and just try to work with brackets. Because I can`t extract psd files in my ps version, did it with project parfait. Then I`ve sended that file or better copied the public link into brackets and found my psd file extracted in layers in there. What I miss is the html code, which I`m desperately looking for. So how do I get an html code out of that psd file to create a webpage with brackets, without buying a new ps version...  thanks a lot in advance !

    If you not too familiar with html, you can use the save as web command. When you open the dialog box, towards the bottom you will find preview in Brower. First it will show you the image, but if you scroll down you will see the sample html that was used to create that image in the browser.
    If you need to break it up some you can use slices. Each slice will be its own image.
    The html needs to point to that image on the server.
    This means you need to upload the html and all images to a server. It also means that you will need to manually edit the html so that it has the correct folder location on the server so it can find the images.
    It is one thing to make it work on your computer, it is another story to make sure it works from a server. Usually a typo is what keeps it from working correctly. So pay attention to the url, folders and file names. Keep in mind that folders and files are case sensitive.
    Good luck.

  • How to get Source Code out of SCA File

    I have a SCA file comprising SAP Ecommerce 5 solution. What I want to achieve is to get all the source code out of it including the original directory structure. Unzipping it doesn't give me the required results and requires a lot of manual work creating directories and more unzipping.
    I tried importing it into a Local SC in NWDS but it complains that " Import (into source SC) not possible: SCA doesn't contain DC sources".
    I don't have access to NWDI at this point.

    Hi,
    For getting the source code of the Business Package Content, follow the steps below:
    1. Make sure Source Archive is available for the Business Package.
    2. Create a NWDI Track, and include all dependencies (check SAP Note : 1080927 - Creating CMS Tracks for common Application Types )
    3. Once you have track in place, you can import the Track into NWDS
    4. In Development Configurations perspective of the NWDS you can see the track.
    5. Now create Project from Inactive Workspace to start modifying the code.
    Check the link for general links
    http://wiki.sdn.sap.com/wiki/display/JDI/NWDIRelatedNotesandLinks
    Hope this helps.
    Cheers-
    Pramod

  • How to make my waveform from excel file perodic in labview graph

    Hi guys,
    Previously I've made a vi which integrates the excel file, to plot the graph values in labview using the values in the excel file to give the me a better flexibility to decide what waveform i want it to be. Can i know how to actually make the graph periodic, as in the waveform repeats,  because currently it can just plot out the waveform accordingly to the values i inserted in the excel. I've attached my vi and aso my csv file together. Thanks guy.
    Attachments:
    12.csv ‏1 KB
    graph.vi ‏18 KB

    So do you want to read the same values over again?
    If that is what you wish to achieve then use waveform chart as opposed to waveform graph. I editted your code slightly so that you can see the different.
    I hope this helps!
    Mehak D.
    Attachments:
    graph.vi ‏18 KB

Maybe you are looking for

  • Move Time Capsule and Laptop to New Network

    I have been searching the forums it haven't found a clear answer to this question.  I have been backing up my laptop using Time Machine and Time Capsule on one wireless network (TC has joined the wireless network, it does not serve as the router for

  • IWeb hypertext links to pages from my site not "viewable" in some browsers

    I am new to iWeb 08. iWeb created hypertext links to eleven pages from my "top level" site are not "clickable" or viewable in some browsers yet the hyperlinks I added on top page to other sites don't present a problem. No problem with Safari or AOL D

  • SunStudio 11: unable to get collector to work

    I'm using BEA WebLogic 8 & java jdk 1.4.2_08. I have written a servlet in C++ and it works fine with Weblogic. However I need to look at the bottlenecks when I have multiple threads running. I have tried using LD_PRELOAD when starting weblogic and th

  • Disk Space Issues

    Does anyone out there have best practice insights on how to deal with disk space issues on the database server?  Can we copy the files onto different drives and then rename the drives?  Will everything with the BPC application sync up again? Is there

  • Error 7 occurred when building Exe in LabVIEW2010 SP1

    Hi All, I wanted to build an Exe for my Application. When I created an Exe and give Generate Preview, I got the following warning. Further, I tried to delete most of the code and give generate preview I didnt get any warning but I dont know, What is