Mapping query result to excel sheet
Hi Experts,
i have a requirement where in i need to map the result into particular cellls of the excel sheet, because the excel sheet acts as front end which has graphs and by just putting the result in particular cells of excel the graph is automatically generated, so is there any way where i can map the result cells into particulat cells in excel?
Thank you.
Hi Shetty,
You might have stopped reading this thread since you have the answer you need for now. From experience, let me tell you what might happen next.
If the query definition is ever changed ... say, a new characteristic is added because a different user has a slightly different need ... the result table will move down by a few rows and your equation no longer works.
If you think this might happen, let me tell you a very easy way to get around it.
1. Name the range(s) you will use. If the first result is in cell B31 on Sheet1, then go to cell B31 on Sheet1 and Select Insert>>Name>>Define. Call it something you will remember, like "LastMonthSales" (no spaces, but underline is OK)
2. use the range name in your formula. This happens automatically, in fact. If you press = then click on cell B31, Excel will automatically use the range name instead of the range address. Excel LIKES names.
3. now, go to the Visual Basic Editor (Tools >> Macro >> Visual Basic Editor; or, Alt+F11). In your workbook, there should be a subroutine as follows:
Sub SAPBEXonRefresh(queryID As String, resultArea As Range)
If you do not find it, add it. This probably also means that you are using Excel 2002 or later and have not set your Macro security to "trust access to Visual Basic Project"; so, change that security setting (Tools >> Options >> Security >> Macro Settings).
The visual basic code is very simple. For each result that you need to map you will want one line of code like this one:
resultArea.Cells(4, 2).Name = "LastMonthSales"
The Cells(4, 2) are counted from the top left of the result table. So, in this case if B31 = Cells(4,2), then the top left of my result table must have been in cell A28 in Excel.
This subroutine will be run automatically every time that the query is refreshed. So, if the result table moves, the names will move with it. One less thing to worry about.
If you do not think you need to do this today, don't! No sense in doing work that is not necessary. But, save this. I suspect that some day you will need it.
- Pete
Similar Messages
-
Result of a Query in an Excel Sheet??
Hi,
I am using sqlplus on Unix environment.
How can I get the results of a query (a multi column select query) into a excel sheet, which I can later SCP to my windows environment.
Kindly reply asap.
Thanks In Advance :)
AbhiYou might be able to use the sqlplus colsep command
http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14357/ch12040.htm#sthref2716
SQL> set colsep ','
SQL> select * from emp;
EMPNO,ENAME ,JOB , MGR,HIREDATE , SAL, COMM, DEPTNO
7369,SMITH ,CLERK , 7902,17-DEC-80, 800, , 20
7499,ALLEN ,SALESMAN , 7698,20-FEB-81, 1600, 300, 30
7521,WARD ,SALESMAN , 7698,22-FEB-81, 1250, 500, 30
7566,JONES ,MANAGER , 7839,02-APR-81, 2975, , 20
7654,MARTIN ,SALESMAN , 7698,28-SEP-81, 1250, 1400, 30
7698,BLAKE ,MANAGER , 7839,01-MAY-81, 2850, , 30
7782,CLARK ,MANAGER , 7839,09-JUN-81, 2450, , 10
7788,SCOTT ,ANALYST , 7566,09-DEC-82, 3000, , 20
7839,KING ,PRESIDENT, ,17-NOV-81, 5000, , 10
7844,TURNER ,SALESMAN , 7698,08-SEP-81, 1500, 0, 30
7876,ADAMS ,CLERK , 7788,12-JAN-83, 1100, , 20
7900,JAMES ,CLERK , 7698,03-DEC-81, 950, , 30
7902,FORD ,ANALYST , 7566,03-DEC-81, 3000, , 20
7934,MILLER ,CLERK , 7782,23-JAN-82, 1300, , 40
14 rows selected.
SQL> -
Owb mapping result in excel sheet
hi ,
can anyone help me to know how i can get owb mapping running status & result in excel sheet.
I have completely forget it.
kindly help.
rgds,
pcHi,
You can view the status by qurying wb_rt_audit_map_runs from any SQL client.
From there your can copy the output to excel.
Otherwise you can use OWB repository browser to view the mapping running status report.
Regards,
Pnreddy -
How to save query result in excel file
Hi all,
How to save query result in excel file from sql*plus tool.
thank youDo 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 -
Http 404 error exporting query result into Excel.
Hello. I'm getting an Http 404 The webpage cannot be found" error when trying to export any APEX application's query results into Excel (Application Express 3.2.1.00.10). This was working fine before. Nothing changed with our APEX application. I've been always using I.E. Version 7.0.5730.11 with no problems. I've reset the I.E. defaults and still the problem exists. I've downloaded Mozilla Firefox and the problem does not happen. However, I would like to know why my I.E. still gets this error? Any feedback or suggestions would greatly be appreciated. Thanks for your time.
My EI settings are as follows:
Tools -> Internet Options -> Security
All Three: Internet, Local Intrarnet, and Trusted Sites ... at Custom Level have the following settings:
Downloads:
Automatic prompting for file downloads = Enable
File download = Enable
Font download = Enable
Problem still exists.
Thanks for the help.... any additional feedback or suggestions would greatly be appreciated. Thanks for your time. -
hi,
Is there a way to save the query results as excel programatically (some kind of utility which does the job)? we are using oracle 10g. This will be a nightly job.. so that every other day morning we have the huge excel report ready for viewing. Any help is appreciated..Did you think to try searching the forum? I typed in the EXACT string you used for your thread title and the first hit was ...
Saving sql query result as excel file -
Hi Friends,
Instead of display Sheet 1 in the Excel sheet tab(Bex), is there a way we can display Query Name in the excel sheet tab? please let me know.
Thanks,
KKHi Kumar
Can you please share how it was solved ?
Ashish -
Display Query results in excel on the Web
Hello,
I am trying to display data from a query in excel on the web without creating an actual file. I know that I can create a CSV file using UTL_FILE and display it but I was hoping there was a way to do it without actually creating the file. I have a procedure that looks similar to
PROCEDURE displayAsCSV is
cursor STUD_CURS is
select * from students;
BEGIN
for STUD_REC in STUD_CURS loop
htp.print(' " '||STUD_REC.FIRST_NAME||' " , " '||STUD_REC.LAST_NAME||' " ');
end loop;
END;
Does anyone know if it is possible to display these results in excel in the browser by altering the MIME types or something similar?
ThanksCheck Tom's owa_sylk utility together with the appropriate mime-type.
-
Hello,
I can't map string Display Name to the string property, on the User prompts tab I set prompt with type Query Result, on the Configure Prompts I configure this query by selecting AD User of Group -> Display Name, now I have Prompt Output called DisplayName
(string). On the Map prompts I can't map this prompt to the string property, why? I just want to choose one user from AD and put it on the form as string.You will never get "simple values" from a query result. The option "3. Display Columns" are the properties on the class that you display on the portal. You will not be able to map a query result anywhere. You must attach it somehow to the request (in the
last tab "4. Options").
So even though the prompt output says "DisplayName (string)" you are still getting an object out of it. This makes more sense if you select more properties in 3.
http://codebeaver.blogspot.dk/
Thanks fro info, I have a script which reads custom string property of my custom service request class and translates it to 'AD user class' and makes it as Reviewer in the Review Activity. But instead of textbox field on the portal I need to use query,
how can I get info from this service request about query to create AD user in my script?
I placed query form on the portal to test, it shows only 2000 objects by default, is it possisble to show members of some OU or group in this field? -
Problems exporting query results to Excel
Hi!
I hope you can help me
We have a web template that uses the class ZVIG_ART that we created in the transaction SE24, this class display some label in the query
results, the problem is when we export this report to excel the label disappear. The numbers indicates the stock of the item and the label N/V indicates that the item is not in the store's catalog. Another case is that we can have N/V items but with stock, for example the ITEM2 of the STORE3 with the label N/V-1piece. How can we export this label to EXCEL?
| STORE1 | STORE2 | STORE3
ITEM1 | 10 PIECES | N/V | 20 PIECES
ITEM2 | 11 | 20 | N/V-1PIECE
Thanks in advanced.
Veronica B.Hi Mari,
Thanks for the reply.
I can understand the resason for not being able to change the Posting Date. But what are the reasons for not being able to change the Document Date? What is the fiscal reason for not being able to change the Document Date? Please provide an example. Reversing the document doesn't work in this case as the SQ01 report would still include the incorrect date.
Regards,
Gary -
How to open the TFS query results in Excel?
Hello Guys,
Question 1: Is there any way to export the query results from the TFS web browser?
Question 2: Is there any way to export the query results from Team Explorer 2013?
Here is the query results in TFS:
How do I export this result in excel for further analysis?
I have also connected to Team explorer 2013 and right clicked on the query, but there is no option to open the results in Excel, see below:Hello,
_Pls follow these guide lines for ensuring proper output in Microsoft Excel:
1.First compare the fields properties and the frames properties between the reports created with wizard and the reports created manually.
2. Do not leave any space between two adjacent objects.
Explanation: Because any space, including a few pixels, between two adjacent objects will result in an empty cell or column in Excel output
3.Make sure that the widths of all objects are vertically consistent.
Explanation: If the objects are not exactly aligned vertically, that is, have inconsistent widths, it is likely to result in insertion of unwanted cells/columns in Excel.
4. Pls. Make sure that the vertical elasticity of the frames and repeating frames is not fixed unless you are sure you have allocated enough space to accommodate all the records.
Explanation: If you set the Vertical Elasticity property of a frame to Fixed, the output in Excel will show only as many records as could appear on the first page of the paper output. Since Excel does not have a page concept, it is not able to overflow the remaining rows to the next page.
5. For reliable formatting of spreadsheet output, enclose the whole layout area in a frame.
Explanation: This action prevents the possibility of parallel objects displaying in different vertical positions, one following the other.
Hope this helps.
Regards,
Alex -
Export query results to excel from forms
Are there any ways to export query results to MS Excel format files from a form.
Thanks.Here's my working code out of one of my forms that does this:
PROCEDURE export_transactions_to_excel IS
-- Declare the ole objects
application ole2.obj_type;
workbooks ole2.obj_type;
workbook ole2.obj_type;
worksheets ole2.obj_Type;
worksheet ole2.obj_type;
cell ole2.obj_type;
-- my variables
rowCounter Number := 1;
local_cursor_Record number := :System.Cursor_Record;
old_cursor_Style varchar2(100);
errors_occurred boolean := false;
Ole_Error Exception;
pragma exception_init( Ole_Error, -305500 );
my_alert_id ALERT;
alert_response NUMBER;
procedure place_value_in_cell( rownum_in in number
, colnum_in in number
, value_in in varchar2 )
is
-- Declare handles to OLE argument lists
args ole2.list_Type;
begin
args := ole2.create_arglist;
ole2.add_arg(args, rownum_in); /* row number */
ole2.add_arg(args, colnum_in); /* column number */
-- the next line is for excel97
-- cell := ole2.invoke_obj( worksheet, 'Cells', args );
cell := ole2.get_obj_property( worksheet, 'Cells', args );
ole2.Destroy_arglist( args );
ole2.set_property( cell, 'Value', value_in );
ole2.release_obj (cell);
end place_value_in_cell;
procedure SaveSpreadsheet
is
args ole2.List_Type;
vDateStamp varchar2(20);
begin
vDateStamp := to_char(sysdate,'mmddyyyy') | | '_' | | to_char(sysdate,'hh24miss');
args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(args, 'C:\PAPRETCC_' | | vDateStamp | | '.XLS');
OLE2.INVOKE(worksheet, 'SaveAs', args);
OLE2.DESTROY_ARGLIST(args);
--args := Ole2.Create_ARgList;
ole2.invoke( application, 'Quit' );
end SaveSpreadSheet;
procedure Open_EXCEL_Workbook is
Begin
application := ole2.create_obj('Excel.Application');
--ole2.set_property( application, 'Visible', 'True' );
-- Return object handle to the Workbooks collection
workbooks := ole2.get_obj_property( application, 'Workbooks' ); -- invoke_obj w/ excel 97
-- Add a new Workbook object to the Workbooks collection
workbook := ole2.invoke_obj( workbooks, 'Add' );
-- return object handle to the Worksheets collection for the
-- Workbook
worksheets := ole2.get_obj_property( workbook, 'Worksheets' ); -- invoke_obj w/ Excel97
-- Add a new Worksheet to the Worksheets collection
worksheet := ole2.invoke_obj( worksheets, 'Add');
end open_EXCEL_workbook;
PROCEDURE Write_Column_Headers IS
BEGIN
place_value_in_cell(rowCounter,1, 'Payer Name');
place_Value_in_cell(rowCounter,2, 'Payer Address');
place_value_in_cell(rowCounter,3, 'SSN');
place_value_in_cell(rowCounter,4, 'Account');
place_value_in_cell(rowCounter,5, 'Refund Receipt');
place_value_in_cell(rowCounter,6, 'Pretax Allocation');
place_value_in_cell(rowCounter,7, 'Tax Allocation');
place_value_in_cell(rowCounter,8, 'Total Amount');
place_value_in_cell(rowCounter,9, 'Orig Receipt');
place_value_in_cell(rowCounter,10,'Orig Date');
place_value_in_cell(rowCounter,11,'TR Number');
place_value_in_Cell(rowCounter,12,'Date');
place_Value_in_cell(rowCounter,13,'Status');
place_value_in_cell(rowCounter,14,'Vt Number');
rowCounter := rowCounter + 1;
END Write_Column_Headers;
PROCEDURE Export_The_Data IS
original_receipt number;
original_date DATE;
original_transmittal_number number;
BEGIN
-- Return object handle to cell A1 on the Worksheet
Go_block('Transactions');
First_Record;
LOOP
IF alert_response = ALERT_BUTTON2 or
(alert_response = ALERT_BUTTON1 and nvl(:transactions.rg_approval,'N') <> 'N' )
-- :system.record_status = 'CHANGED')
then
place_value_in_cell( rowCounter, 1, :TRANSACTIONS.NDB_PAYEE_NAME );
place_value_in_cell( rowCounter, 2, nvl(:TRANSACTIONS.NDB_PAYEE_ADDRESS,'unknown') );
place_value_in_cell( rowCounter, 3, nvl(:TRANSACTIONS.NDB_SSN,'unknown') );
place_value_in_cell( rowCounter, 4, :transactions.NDB_DESCRIPTION );
place_value_in_cell( rowCounter, 5, to_char(:Transactions.transaction_group_EID) );
place_Value_in_cell( rowCounter, 6, to_char(:transactions.ndb_pretax_amount) ); -- chg
place_ value_in_Cell( rowCounter, 7, to_char(:transactions.ndb_tax_amount) );
place_value_in_cell( rowCounter, 8, to_char(:transactions.amount_including_taxes) );
original_receipt := revenue_pkg.original_receipt_number(
:transactions.transaction_group_eid,
:transactions.allocation_eid,
:transactions.allocation_table );
original_date := revenue_pkg.original_receipt_date(
:transactions.transaction_group_eid,
:transactions.allocation_eid,
:transactions.allocation_table );
original_transmittal_number := revenue_pkg.transmittal_number_for_receipt(original_receipt);
place_value_in_cell( rowCounter, 9, nvl(to_char(original_receipt),'unknown') );
place_value_in_cell( rowCounter, 10, nvl(to_char(original_date,'mm/dd/yyyy hh24:mi:ss'),'unknown') );
place_value_in_cell( rowCounter, 11, nvl(to_char(original_transmittal_number),'unknown') );
-- COMPTROLLER COLUMNS
IF ( alert_response = ALERT_BUTTON1 and nvl(:transactions.rg_approval,'N') <> 'N' )
THEN
place_value_in_cell( rowCounter, 12, to_Char(sysdate,'mm/dd/yyyy') );
place_value_in_cell( rowCounter, 13, nvl(:transactions.rg_approval,'N') );
place_value_in_cell( rowCounter, 14, nvl(to_char(:location.vt_number),'NULL') );
END IF;
End If;
exit when :SYSTEM.LAST_RECORD = 'TRUE';
NEXT_RECORD;
rowCounter := rowCounter + 1;
END LOOP;
END Export_The_Data;
/* ----------------------------------- main procedure --------------------------------------*/
BEGIN
Begin
my_alert_id := Find_Alert('THREE_BUTTON_ALERT');
IF NOT ID_NULL( my_alert_id ) then
alert_Response := SHOW_ALERT( my_alert_id );
If (alert_response = ALERT_BUTTON1) OR
(alert_response = ALERT_BUTTON2) then
old_Cursor_style := get_application_property( CURSOR_STYLE );
set_application_property( CURSOR_STYLE, 'BUSY' );
Open_EXCEL_WorkBook;
Write_Column_Headers;
Export_The_Data;
Else
Raise Form_Trigger_Failure;
End If;
Else
Raise Form_Trigger_Failure;
End If;
exception
when Form_Trigger_Failure then
RAISE;
when Ole_Error then
AlertSend( 'There was an error exporting the data to Microsoft Excel (receipt# ' | |
to_Char(:transactions.transaction_Group_eid) | | ')', false );
errors_occurred := TRUE;
when others then
AlertSend( SQLERRM, false );
errors_occurred := TRUE;
End;
Ideally, I'd like to call SaveSpreadsheet in Export_The_Data, and just ExitExcel here,
but it prompts for whether to save the changes and I don't know how to get around that
right now. SO, we just save and exit, regardless.
SaveSpreadSheet;
-- Release the OLE objects
ole2.release_obj (worksheet);
ole2.release_obj (worksheets);
ole2.release_obj (workbook);
ole2.release_obj (workbooks);
ole2.release_obj (application);
IF NOT errors_occurred then -- stay on the record that caused the error
Go_Record( local_cursor_Record );
End If;
Set_Application_Property ( CURSOR_STYLE, old_cursor_style );
EXCEPTION
When Form_Trigger_Failure then
null;
When Others then
AlertSend( SQLERRM );
END export_transactions_to_excel; -
PL/SQL to map query results to a column?
Is there a programmatic way to map the query result to a value in a table?
I have table A. There's a column with a carat-delimited string 0^0^1^ that I can parse with substr/instr functions. So, query that table/column for a 5th digit that sits between 5th and 6th ^ character.
There's table B. It has a 'position' column and 'key' column. How do I let the table A know that when I query table A for 5th digit, it needs to map to table B's where position=5?
thanks,Did you try to run those statements? Please do so next time.
Also the creation of table C (or is it D) and E are missing.
However, the tricky part is in deciphering table A to make up for the flawed design.
I hope this piece of SQL is helpful for you, because you could join the outcome to your other tables:
SQL> create table a
2 ( visitor_id number(*,0),
3 adate date,
4 carat varchar2(4000 byte),
5 ip_address varchar2(4000 byte),
6 state varchar2(4000 byte),
7 city varchar2(4000 byte),
8 id number(*,0) not null enable,
9 constraint "a" primary key (id)
10 )
11 /
Tabel is aangemaakt.
SQL> insert into A
2 (VISITOR_ID,ADATE,CARAT,IP_ADDRESS,STATE,city,id) VALUES(194296532,TO_DATE('2007-06-26.00.01.46',''),'-1^1^2^0^3^85741^3^0^176^0^1
^-1^41^-1^-1^US^0^-1^2^0^1^^^^^^^','71.226.9.44','az','tucson',1);
1 rij is aangemaakt.
SQL> insert into A
2 (VISITOR_ID,ADATE,CARAT,IP_ADDRESS,STATE,city,id) VALUES(37482918,TO_DATE('2007-06-26.00.01.46',''),'0^1^2^5^^78154^3^7^184^0^1^2^
17^2^1^US^1^0^1^0^0^^^^^^^','70.163.196.111','tx','san antonio',2);
1 rij is aangemaakt.
SQL> select id
2 , visitor_id
3 , i position
4 , c value
5 from a
6 model
7 return updated rows
8 partition by (id, visitor_id)
9 dimension by (0 i)
10 measures ('^' || carat || '^' c)
11 rules
12 ( c[for i from 1 to length(regexp_replace(c[0],'[^\^]'))-1 increment 1]
13 = regexp_substr(c[0],'[^\^]+',1,cv(i))
14 )
15 order by id
16 , position
17 /
ID VISITOR_ID POSITION VALUE
1 194296532 1 -1
1 194296532 2 1
1 194296532 3 2
1 194296532 4 0
1 194296532 5 3
1 194296532 6 85741
1 194296532 7 3
1 194296532 8 0
1 194296532 9 176
1 194296532 10 0
1 194296532 11 1
1 194296532 12 -1
1 194296532 13 41
1 194296532 14 -1
1 194296532 15 -1
1 194296532 16 US
1 194296532 17 0
1 194296532 18 -1
1 194296532 19 2
1 194296532 20 0
1 194296532 21 1
1 194296532 22
1 194296532 23
1 194296532 24
1 194296532 25
1 194296532 26
1 194296532 27
1 194296532 28
2 37482918 1 0
2 37482918 2 1
2 37482918 3 2
2 37482918 4 5
2 37482918 5 78154
2 37482918 6 3
2 37482918 7 7
2 37482918 8 184
2 37482918 9 0
2 37482918 10 1
2 37482918 11 2
2 37482918 12 17
2 37482918 13 2
2 37482918 14 1
2 37482918 15 US
2 37482918 16 1
2 37482918 17 0
2 37482918 18 1
2 37482918 19 0
2 37482918 20 0
2 37482918 21
2 37482918 22
2 37482918 23
2 37482918 24
2 37482918 25
2 37482918 26
2 37482918 27
2 37482918 28
56 rijen zijn geselecteerd.Regards,
Rob. -
Download search result in Excel sheet
hello Experts ,
I am working on UCM 11g.
We have a search template which helps us to search on UCM. I have to extract our search result in MS excel sheet. Could you please suggest the easiest way for it?
Thanks,
MaheshHello,
I have been trying to create the following component from BEX's book, which creates an extra value on a drop down to export search resullts to a CSV file:
<@dynamichtml custom_searchapi_result_options@>
<$include super.custom_searchapi_result_options$>
<option value="window.location='<$HttpCgiPath$>?<$QUERY_STRING
$>&IsJava=1&MergeInclude=spreadsheet_search_results'">
Download Spreadsheet</option>
<@end@>
<@dynamichtml spreadsheet_search_results@>
Title,Author,Date,Security Group,Content ID,Content Type
<$loop SearchResults$><$dDocTitle$>,<$dDocAuthor$>,<$dInDate
$>,<$dSecurityGroup$>,<$dDocName$>,<$dDocType$>
<$endloop$>
<$setContentType("text/csv")$>
<$setHttpHeader("Content-Disposition",
"attachment;filename=search_results.csv")$>
<@end@>
As this drop down is now different in UCM 10gR3 this no longer appears to work (I get an error when adding these as a resource file) I presume I need change this include "$include super.custom_searchapi_result_options". How do I find out which include to use? I am quite new to creating custom components.
Thanks for your help, -
Query output to excel sheet...pls solve my problem here !
Hi all,
I have written a procedure which accepts parameters and generate a web page.
The web page generated records as fetched from cursor within procedure.
My requirement is to generate it as a excel sheet once run through url.
I am getting as a text inspite using
owa_util.mime_header('ms-excel');
within my code.....
can you pls help or send me code which could do above task...:)
Thanks in advance.
Regards
RavikanthTry this instead :
OWA_UTIL.MIME_HEADER('application/vnd.ms-excel');
Barry C
http://www.myoracleportal.com
Maybe you are looking for
-
HP -Other hardware, printer - Null Fax - HP Officejet 8610
I recently update to Windows 8.1 from Windows 8 on a desk top machine. Everything went well until Windows is trying to install an update for this printer (HP Officejet 8610). It is getting error 8007002. I checked the Windows site to find a fix and f
-
Stripes in Lightroom 5.2
Yesterday evening suddenly a lot of stripes ecpired on the oictures where I worked with. the original are still good but when i want to develop them I takes a lot of time that the pictures is ready and then it is unuseable because of the colored stri
-
Auto Adding Chapter Markers in FCPX?
Is there a way to easily add chapter markers per edit in FCPX? I have a timeline of over 100 clips and I'd like to add a chapter marker at the very beginning of each new clip. I've seen this question asked on the internet a few times but they were a
-
How do I fill out this document in Adobe?
-
How to create hovering effect?
Hi Experts, I have to create hovering effect in portal. I want to show top level navigation to the users. I want to remove detailed navigation from the portal. When any user will put the mouse over the top level navigation, then detailed navigation s