Automate query that export to excel
Hi,
I'm not sure if this is the right place to post this question... but....
I run some queries every day and export to an excel file and send by email every day, there is any way to make it automatic?
Do anyone have any suggestion?
Thanks,
Leandro Takeda
You can use Dump_Csv developed by tom kyte. Below is the code that i modified for my requirement.
create or replace function dump_csv( p_query in varchar2,
p_separator in varchar2
default ',',
p_dir in varchar2 ,
p_filename in varchar2 )
return number
AUTHID CURRENT_USER
is
l_output utl_file.file_type;
l_theCursor integer default dbms_sql.open_cursor;
l_columnValue varchar2(2000);
l_status integer;
l_colCnt number default 0;
l_separator varchar2(10) default '';
l_cnt number default 0;
l_colDesc dbms_sql.DESC_TAB;
begin
l_output := utl_file.fopen( p_dir, p_filename, 'w' );
dbms_sql.parse( l_theCursor, p_query, dbms_sql.native );
for i in 1 .. 255 loop
begin
dbms_sql.define_column( l_theCursor, i,
l_columnValue, 2000 );
l_colCnt := i;
exception
when others then
if ( sqlcode = -1007 ) then exit;
else
raise;
end if;
end;
end loop;
dbms_sql.define_column( l_theCursor, 1, l_columnValue, 2000 );
l_status := dbms_sql.execute(l_theCursor);
dbms_sql.describe_columns(l_theCursor,l_colCnt, l_colDesc);
l_separator := '';
for lColCnt in 1..l_colCnt
loop
utl_file.put( l_output, l_separator || '"' || Upper(l_colDesc(lColCnt).col_name) || '"');
l_separator := p_separator;
end loop;
utl_file.new_line( l_output );
loop
exit when ( dbms_sql.fetch_rows(l_theCursor) <= 0 );
l_separator := '';
for i in 1 .. l_colCnt loop
dbms_sql.column_value( l_theCursor, i,
l_columnValue );
utl_file.put( l_output, l_separator || '"' ||
l_columnValue || '"');
l_separator := p_separator;
end loop;
utl_file.new_line( l_output );
l_cnt := l_cnt+1;
end loop;
dbms_sql.close_cursor(l_theCursor);
utl_file.fclose( l_output );
return l_cnt;
end dump_csv;Thanks,
Karthick.
Similar Messages
-
Query on Export to Excel- Help needed
Hi All,
I wanted to know if we can set a hidden field value when user clicks on the "export to excel" link in the reports.
I am using the Apex Export feature itself. Is it possible to set an item value when user clicks on the link?
If yes then how can we do it? If no can you please let me know the other options available?
Thanks,
SumanaThanks Denes!
I understood how to trigger the process on click of the export to csv link. As of now i will implement that in my application..
I just wanted to know if "the" dialog box could be controlled.
But later maybe,( if my client really needs it...), I will have to use my custom export to excel option. I have even downloaded your download-excel.
But it says that it cant be used for pl/sql returning function....
Is there a workaround on that?
And I will tell you the difference it makes to my application.
Current Requirement: I need to track the information (for e.g say user id's) that have been sold to a customer. I am doing this by inserting the data exported by user to the table. This must happen only when user saves the file. Only when user saves the file, the information is considered as "Slod".
Now if the user click on export to csv link but simply opens or cancels the file download, that information is not considered as "Sold"
Hence my need, that i could control the dialog box. Hope this clears your doubt.
Regards,
Sumana -
Automate Query and Export in HTML to Sharepoint
Hello,
Currently I'm using Disco Plus and I'm finding out that I don't have the ability to automate a report and export the result. In this case, I'm wanting to export in HTML format to a Sharepoint drive.
I found a recent post saying that there you can script it with Disco Desktop but I don't have that installed and I'm not certain where I can get it... is it possible to download and install yourself or would my IT group need to install it (i have admin privileges to my machine). Is there a licensing fee separate for Desktop? Here are my Disco and system particulars if that helps:
OracleBI Discoverer 10g (10.1.2.2)
Oracle Business Intelligence Discoverer Plus 10g (10.1.2.54.25)
Discoverer Model - 10.1.2.54.25
Discoverer Server - 10.1.2.54.25
End User Layer - 5.1.1.0.0.0
End User Layer Library - 10.1.2.54.25
PivotManHi PivotMan
It is possible to download and install Discoverer Desktop yourself as the install is very, very easy. There is, as you suspect, a license issue though in that Discoverer Desktop is not licensed along with your Plus and Viewer licenses and is priced, I believe, at $1,200 per seat.
If your company has a Discoverer Adminstrator using the Administrator tool then you may not be aware that the license for Admin also includes a license for Desktop and it is probably already installed.
Independently, you can download the Desktop software, as part of the Tools CD, from OTN at this address: http://www.oracle.com/technology/software/products/ids/htdocs/101202winsoft.html
The download you want is the second one, the Oracle Business Intelligence Tools 1og (10.1.2.0.2) for Microsoft Windows.
Be wary though because your company has probably upgraded Discoverer to either 10.1.2.2 or 10.1.2.3. You will need to do the same thing for Desktop by downloading the relevant patch from MetaLink. Also, please read the licensing agreement on OTN before downloading and using any Oracle software as you will be required to confirm that you have read and understood Oracle's terms and conditions.
I hope this helps
Best wishes
Michael -
Hi All,
I need some suggestions in using "Export to CSV"
Situation is as follows:
I have a report that gets dispalyed based on many search condiitions. Once the report is dispalyed, and the user clicks on Export to CSV link, i set a hidden item value as 1. My CSV link looks like this(I use this instead of the custom #CSV_LINK#) -
href="f?p=&APP_ID.:&APP_PAGE_ID.:&APP_SESSION.:FLOW_EXCEL_OUTPUT_#REGION_ID#_en-us:::P0_capture_export:1:" >Export to Spreadsheet
Based on this value I have written a pl/sql process that inserts data into table. If this has to be executed, the page needs to be submitted if i select process point as "On Submit". Or the page needs to be reloaded if i select process point as "On Load".
But the problem is that, when user clikcs on "export to csv link" the page is not submitted, and neither is it reloaded.
I need the page to be submitted only after the file dialog box appears.
Any idea how this can be achieved? I tried Javascript reload. This only reloads the page and ignores the "Export request".
Please help. Any suggestions are welcome.
Thanks,
Sumana
Message was edited by:
SumanaSumana,
What you may want to try is to have your custom link submit the page, run your onSubmit process, and then re-direct to another page where you could roll your own CSV export procedure and execute that in a before header process.
You can use the same item references on the second page, so that your exported report has the same data as your displayed report.
See my blog posting on creating custom CSV exports here: http://spendolini.blogspot.com/2006/04/custom-export-to-csv.html
Thanks,
- Scott - -
Export to Excel - data with leading zeros
Does anyone have any tips or tricks for running a query then exporting to Excel without dropping leading zeros from the data?
Examples: numeric Item codes with leading zeros, telephone numbers that have been entered with no spaces.
Regards,
Douglas McDove< Font Color="RED" Size = 3 Face=Verdana>
I liked the challenge and therefore.......I got this for you
</Font>
SELECT CHAR(28) + T0.CardCode [BP Code\] FROM [dbo\].[OCRD\] T0
SELECT CHAR(29) + T0.CardCode [BP Code\] FROM [dbo\].[OCRD\] T0
SELECT CHAR(30) + T0.CardCode [BP Code\] FROM [dbo\].[OCRD\] T0
SELECT CHAR(31) + T0.CardCode [BP Code\] FROM [dbo\].[OCRD\] T0
Any of the above 4 should work. T0.CardCode is the database field I tested, you can substitute this with any database field and it should work.
Regards
Suda -
Hi
If anyone could point me in the right direction as to what steps to take to enable the export to excel option in a sharePoint survey list.
all other surveys are showing up that export to excel option.
I am not seeing the view dropdown as well which shows up on right (the only way to create new view is through the URL as of now)
Constraints
Survey already has several responses now so making a new survey is not an option
(I know that when is any custom view is changed to default view and if Overview is made as the default view again this option goes away, but how to get this export to excel option back?)
Steps taken till now
Checked in SP designer as to which field is set to default and it shows overview as the default.
Checked whether any web part was closed and it seems there was none else closed web part category would've shown up
Saved the existing survey as template both with the content included and without the content (without the content template has the export to excel option showing up)
Many thanks ,
AbAby,
Do following, it will work
Create a simple list and hit export to excel to create owssvr.iqy file
Open that file in notepad
Collect Survey list' GUID and View GUID from SPD. You need to change the pointer to test list to survey
Change list GUID and view Guid
File will contain these code
WEB
1
https://mycomp.sharepoint.com/sites/RND/_vti_bin/owssvr.dll?XMLDATA=1&List={577F5EF1-DA61-4BAD-B912-E16CEFD72AE2}&View={05CF5C6B-92F0-4681-BC4A-F60E2646A41D}&RowLimit=0&RootFolder=%2fsites%2fRND%2fReports%20List
Selection={9CC32EE5-7C16-49EE-9BA1-136C1ADBEBEF}-{2D172036-F4BF-459D-BBAB-4FEE3310511D}
EditWebPage=
Formatting=None
PreFormattedTextToColumns=True
ConsecutiveDelimitersAsOne=True
SingleBlockTextImport=False
DisableDateRecognition=False
DisableRedirections=False
SharePointApplication=https://mycomp.sharepoint.com/sites/RND/_vti_bin
SharePointListView={05CF5C6B-92F0-4681-BC4A-F60E2646A41D}
SharePointListName={577F5EF1-DA61-4BAD-B912-E16CEFD72AE2}
RootFolder=/sites/RND/Reports List
It will work :)
Please 'propose as answer' if it helped you, also 'vote helpful' if you like this reply. -
Underlay row not exported to excel to a single row
Happy New Year to all,
I have an underlay function in Details a section. I also have Details b thru Details z sections. When using the underlay feature in Details a, it lines up beautifully with Details b row. However, when I export to excel data only, Details a appears on its own row above Details b. What can I do to have the underlay row, Details a export alongside Details b in the same row?
Thanks in advance,
Regards,
Zack H.Hi zack
Iam not giving yout he straight forward solution. but here are my inputs,
1. please check exportingto PDF? if it is fine, then we have to align the report in such a way that export to excel will bring desired result. ioe we have to design, Keeping the result in mind.
Because, the technique used to export to oexcel is line by line scanning method here as to PDF it is snap shot kind of.
Best regards
usama -
Automatic export to excel of a query
Hi all,
I have a query I must run on a daily basis and export the results to excel format them with a certain font and size and send it via email. Is there a way to automate all of this?
ThanksHello;
Yes I believe so.
I would look to a reporting tool. For example Business Objects will auto generate and e-mail reports. Since they also export to Excel I'm thinking they can handle most of your requirements. If they can export to an Excel Template that might be one way to handle your font type and size.
In any event I believe a reporting tool is you best option.
Best Regards
mseberg
This example shows how to email Scheduled Reports in Business Objects and delivered / emailed in MS Excel format.
http://www.letslearnbi.com/2009/05/how-to-email-scheduled-reports-in.html
So certain third part tools will do the job.
Edited by: mseberg on Nov 18, 2011 7:26 AM -
Export to Excel from Report region (pl/sql returning sql query)
Hello all,
I have encountered an interesting problem. I have an HTMLDB application with a lot of sql reports coded straight inside the report region. In order to better organize my reports, I decided to
1. make all my report regions of type "Pl/Sql function returning SQL query"
2. create a package inside my database schema which houses all reports as pl/sql functions returning VARCHAR2, the string returned being the report query
3. just calling "return package_name.function_name" from inside my report region of type "Pl/sql function returning SQL query".
This technique seemed to work perfectly. The reports were being returned as expected. I was then asked to provide the "Export to Excel" capability to all my reports. This seemed like a piece of cake using HTML DB's "Export to Excel" extension. However, the "export to excel" does not function correctly when my reports are inside a package in the database. HTML DB tries to export but inside the excel spreadsheet, instead of seeing row data, I see:
<pre>failed to parse SQL query:
ORA-00936: missing expression
<!-- select a.username, b.table_name, 'View Row Data' from schema_browser_user_list a, all_tables b where a.user_id = and a.username = b.owner order by b.table_name asc
--!>
</pre>
I am building my query string inside of my package functions by using a combination of literal strings and concatenating them with some parameter values being passed in. It seems that the HTML DB engine which exports the report to excel does not properly understand the concatenation of variables as can be seen by the empty space to the right of the equal sign in the "a.user_id = " clause. Does anybody have any input as to whether this is a known issue or if I am doing something wrong? Thanks a lot for your time.
- Kenny R.James,
Thanks for the quick reply. I think you mis-understood what I'm doing. All I'm doing is creating packaged functions which return VARCHAR2. The VARCHAR2 that they return is the report query. With this technique, I no longer have to type the query into the HTML DB report region. Instead, I make the report region a "Pl/sql function returning sql query" and make the following call: return package_name.function_name(some_application_items passed in as parameters)
This makes for a much more organized html db app. The problem is that the "export to excel" function does not correctly interpret the VARCHAR2 that my packaged functions are returning. Is this a better explanation? Thanks again for your time.
- Kenny R. -
Hi,
I am filtering SharePoint list view web part based on Query string parameter and I am doing Export to Excel by using following code.
<a href="#" onclick="javascript:window.location='../_vti_bin/owssvr.dll?CS=109&Using=_layouts/query.iqy&List=0DC67399-BE11-48F3-ADFC-E911FB8B5845&View=54671412-3EFE-4281-835A-9EF747AE774E&CacheControl=1'"><img
alt="Excel" src="/_layouts/images/icxlsx.gif" border="0"/> Export to Excel</a>
Issue: Able to do Export to Excel when there are no filters applied on list view web part but if applied filters on web part and do export to excel , only header fields are displaying in the excel sheet.
I don't know why owssvr.dll is behaving like that .
Please share your ideas.
Thanks in Advance.Hi,
According to your post, my understanding is that you wanted to create hyperlink to export to excel.
The URL to execute the export is as follows:
{Site URL}/_vti_bin/owssvr.dll?CS=109&Using=_layouts/query.iqy&List={List GUID}&View={View GUID}&CacheControl=1
After getting the GUID, you need to “decode” the list GUID.
Replace %7B with {
Replace %2D with –
Replace %7D with }
More information:
Create Link to Export Library Contents to Excel
SharePoint - Create a link to export to Excel
Best Regards,
Linda Li
Linda Li
TechNet Community Support -
Hyperion Workspace Financial Reporting Export to Excel Query-Ready Missing
Hyperion Workspace Financial Reporting Export to Excel "Query-Ready" option is Missing in the dropdown when you go to File>Export>Excel
Only the "Fully Formatted" option is available.
From what I recall this option for a "query-ready" export should be available from the HTML preview?
Is there something in configuration that needs to be enabled or something that needs to be checked on to get this option?
We are running 11.1.1.3
The Query-Ready option is available when exporting forms in Planning.
When opening Financial Reports in Smartview the option for "Query-Ready" is available.
For some reason this is not showing up in workspace, does it not exist in 11.1.1.3? Is this a bug?
TIAHi,
The option to export the financial report output in "Query-Ready" format is actually at the bottom right hand corner of the report page (look at the report footer) instead of File>Export>Excel.
Hope this helps
Genti -
MSS Report Export to excel - ERROR - load: class query not found
Hi All,
I am navigating and getting error as follows:
Manger Services ->My reports -> Report Selection -> HIS Reports -> General -> Employee Details -> add some people and click start report -> report shows -> click local file -> save as spreadsheet get ERROR - load: class query not found in the status bar or IE and IE then locks up
Please reply if any one has some clue.
Thanks & Regards,
VishalHey Vishal,
This issue gave us a very hard time. The query was HRIS manager. when you add some attributes to be exported to excel and then select export. It hangs there. or hangs at the step where you select save as spreadsheet, OR after it where it runs a query to export.
I came to know that Java JRE is used in the last step. So for solving this issue, go to java.com, on the first screen there will be big link to install java(i guess JRE). install it and then try exporting your query. I am sure it will work.
Just notice that after doing installation of Java you will get coffee cup in you system tray.
Thanks.
Ankur.
P.S. Points if works. -
When do export to excel value of char column automatic changes in excel
When do export data , the values of varchar2 column (of oracle) it automatic changes
Eg.
the value in oracle (varchar2(100) is --> 205013113452
when do export to excel it's change to ---> 2.05013E+11
How can I solve this problem?.
Regards
Akbarcreate a view with the order of colums that you want to see in excel and export to excel after selecting that view now you will get the excel columsn with format you like .
-
Create a Union query that automatically adds/contains new tables with a similar name
Dear All,
For a research project i am upscaling from an Access database to SQL server/ SQL azure since the database got far too large. Now i am quite well known with Access, but to be quite honest, I am a SQL rookey. So a lot to learn for me here.
what I need is a union query that automatically adds new research dumps to the query. All research dumps have a table name starting with TD_EXP (Table Dump _ Export). In Access VBA I simply made a loop that builds up the SQL statement, but i have no clue
how to do this within SQL Server...
So, I need the UNION Query to select * from TD_Exp_2012_06_06_15_48 UNON all the TD_Exp_XXXX_XX_XX_XX_XX that are added in the database,
Who could help me out please with a dynamic SQL statement.
Best regards Jurjenyou can use INFORMATION_SCHEMA.TABLES view for that
do like below
DECLARE @Query varchar(max)
SELECT @Query = STUFF((SELECT ' UNION ALL ' + 'SELECT * FROM ' + TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE 'TD_EXP%' FOR XML PATH('')),1,11,'')
SELECT @Query
Add one more condition as below if you want to exclude views from above
DECLARE @Query varchar(max)
SELECT @Query = STUFF((SELECT ' UNION ALL ' + 'SELECT * FROM ' + TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE 'TD_EXP%' AND TABLE_TYPE = 'BASE TABLE' FOR XML PATH('')),1,11,'')
SELECT @Query
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
"Export to Excel" does not work for query based on Master Data InfoSet
We have many queries based on InfoSet consisting 2 or more PS Master Data. After we upgraded from BW 3.1 to 3.5, the "Export To Excel" function no longer works via BEx Browser. It returns all blanks where master data should be shown. Only the non-data area like column headings are exported to excel.
Is this a bug introduced in BW 3.5?
Thanks,
KinukoIt seems that BW 3.5 SP10 may fix this problem.
Maybe you are looking for
-
instead of opening attachment, it will download it and the box will open to ask me to save it. How do i just view the attachment or photo or whatever? == This happened == Every time Firefox opened == not sure
-
Comes With Music - Doesn't Work
Can anyone tell me how I can actually use the service I have paid for? Every time I try to join up, the Nokia Music Store application crashes. If I try and sign in to the Nokia Music Store with the phone connected, it crashes. The PC suite works fine
-
How do i file fraudulent itunes charges on my debit card?
How do i file fraudulent itunes charges on my debit card? I contacted my bank, who told me to contact itunes. When trying to do so, I'm told that i have to pay $29.00 for them to help me resolve this issue. Also, I have an album that has "appeared"
-
Hi, How can i add an undo selection functionality in a jComboBox? I know how it works in textcomponents and buttons but i have a problem with jComboBoxs. Thnx
-
i have a mac computer but i cant seem to find pages its not on the dock where can i find it