SPListItemCollection Export To Excel timer job

I have a timer job that queries specific SPListItemCollection and transform it to DataTable.
I want to export this DataTable to an excel file that will be saved to a specific location (ftp)
how will I do the exporting to excel programmatically? can you share some code snippets that will work for this?
I have tried some codes but it asks me if I want to Save SaveAs or Cancel. What I want is it will immediately download this to a specific location (ftp)
----------------------- Sharepoint Newbie

Hi,
According to your description, after running the code, there is no Excel file generated.
I would suggest you create a Console Application to test the code demo to see if it can work, then apply to your custom timer job.
Here is a demo about creating Excel file from DataTable for your reference:
http://www.codeproject.com/Tips/667392/Create-Excel-file-from-DataTable
Feel free to reply if there any progress.
Thanks
Patrick Liang
Forum Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support,
contact [email protected]
Patrick Liang
TechNet Community Support

Similar Messages

  • Please Help --Export to excel time out issue

    500 Connection timed out
    Hi Friends,
    We have a query which runs about 3 minutes on web and  brings bach 54000 rows  , but when the user tries to export to excel It give timeout error as below.
    Connection timed out (-5)
    Error: -5
    Version: 6020
    Component: ICM
    Module: icxxthr_mt.c
    Line: 2467
    Server: tepas0_abc_00
    Detail: Connection to partner timed out
    Please help me out.
    Thanks a lot!

    Hi,
    Check the info here:
    https://forums.sdn.sap.com/click.jspa?searchID=5203764&messageID=959490
    There are also a lot of other threads on time out issue...
    Hope this helps...

  • Authentication error while exporting the SSRS reports to excel from a timer job.

    Below code written in the timer job Execute() method to render the reports and get the byte array but it works fine when the application run in windows authentication, but throw error when the application extended to Form based authentication in SharePoint
    2013. 
    The sample code is:
    Microsoft.Reporting.WebForms.ReportViewer rview = new Microsoft.Reporting.WebForms.ReportViewer();
    rview.ServerReport.ReportServerUrl = new Uri(reportLib.ParentWeb.Site.RootWeb.Url + "/_vti_bin/ReportServer");
                                            System.Collections.Generic.List<Microsoft.Reporting.WebForms.ReportParameter> paramList = new System.Collections.Generic.List<Microsoft.Reporting.WebForms.ReportParameter>();
                                            rview.ServerReport.ReportPath = reportLib.ParentWeb.Url + RAConstants.LibraryReportLibraryUrl + repotName;
                                            string mimeType, encoding, extension, deviceInfo;
                                            string[] streamids;
                                            Microsoft.Reporting.WebForms.Warning[] warnings;
                                            string format = "Excel";
    deviceInfo =
                                            "<DeviceInfo>" +
                                            "<SimplePageHeaders>True</SimplePageHeaders>" +
                                            "</DeviceInfo>";
    bytes = rview.ServerReport.Render(format, deviceInfo, out mimeType, out encoding, out extension, out streamids, out warnings);
    In above Render() i got below error exception. 
    ex.ToString() "Microsoft.Reporting.WebForms.ReportServerException: Report Server has encountered a SharePoint error. (rsSharePointError) ---> Microsoft.Reporting.WebForms.ReportServerException: The user does not exist or is not unique. ---> Microsoft.Reporting.WebForms.ReportServerException:
    The user does not exist or is not unique.\r\n   --- End of inner exception stack trace ---\r\n   --- End of inner exception stack trace ---\r\n   at Microsoft.Reporting.WebForms.SoapReportExecutionService.ServerReportSoapProxy.OnSoapException(SoapException
    e)\r\n   at Microsoft.Reporting.WebForms.Internal.Soap.ReportingServices2005.Execution.RSExecutionConnection.ProxyMethodInvocation.Execute[TReturn](RSExecutionConnection connection, ProxyMethod`1 initialMethod, ProxyMethod`1 retryMethod)\r\n   at
    Microsoft.Reporting.WebForms.Internal.Soap.ReportingServices2005.Execution.RSExecutionConnection.LoadReport(String Report, String HistoryID)\r\n   at Microsoft.Reporting.WebForms.SoapReportExecutionService.LoadReport(String report, String historyId)\r\n
      at Microsoft.Reporting.WebForms.ServerReport.EnsureExecutionSession()\r\n   at Microsoft.Reporting.WebForms.ServerReport.Render(String format, String deviceInfo, PageCountMode pageCountMode, String& mimeType, String& encoding, String&
    fileNameExtension, String[]& streams, Warning[]& warnings)\r\n   at Microsoft.Reporting.WebForms.Report.Render(String format, String deviceInfo, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams,
    Warning[]& warnings)\r\n   at ResourceAllocationUI.SPJobs.SendWeeklyReportInEmail.Execute(Guid contentDbId)" string
    Please help. Thanks in advance.
    Thanks,
    Rashmi Ranjan

    Likely because your user is continuing to call the service in a Windows (classic) DOMAIN\username format, and not in the Claims identity it should be.
    Trevor Seward
    Follow or contact me at...
    &nbsp&nbsp
    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

  • During export from Discover to Excel, Time Format changes to Number Format

    Hi
    I have a seconds column which is of number datatype. But in my report, I am converting the number in *0HH:MI:SS* format. For example, I have *4952534 seconds*. So my report is showing *1375:42:14* which is a Time Format. It looks good when I view the data in Discoverer Viewer or Plus. But when I try to export the data to Excel, the time format gets converted to *4952534 seconds*, which is creating problems. So can you suggest on how can I preserve the formatting during export to excel from discoverer.
    Thanks
    Sachin

    Hi,
    Excel will not implement the 0HH:MI:SS data format, it just gets the field as a number. You will have to format the field into text using the calculation from my previous post.
    Rod West

  • Problem Export to Excel it takes long time and Takes more space.

    Hello All,
    when we export to Excel in portal(reports), it takes long time and it takes more space.
    how to overcome this problem please any one knows provide the proper solution for this issues
    Regards,
    Ch.

    Hi Chetans,
    I have had the same problem, and I had to create a OSS message to SAP in order to solve this issue, until now I don't have an answer. They made me to change a lot of configuration in Java and BW without luck. To tell you more, when we try to export to excel the java instance restarts aumotatically.
    But we have this problem, when we try to export a huge quantity of data, so I found a note which says the limitation of exporting to excel. Take a special attention to the Performance section.
    Note 1178857
    [https://service.sap.com/sap/support/notes/1178857|https://service.sap.com/sap/support/notes/1178857]
    I recomend you that you create a message to SAP. If you find a solution, please let me know.
    Regards, Federico

  • Date Modified Date/Time Issues on Files Exported to Excel

    Hello -
    I am using Crystal Reports XI, Release 2 and Visual Studio 2005 Enterprise Edition for my ASP.NET application.
    CrystalReports dll version : 11.5.3700.0
    .NET Framework 2.0.50727
    I use the CrystalDecisions.CrystalReports.Engine.ReportDocument to export a report to Excel (ExportFormatType.Excel).
    When you view the exported file in Excel 2007 (just open and close it, making no changes), the Date Modified date of the file changes to whatever date/time the file was last viewed.  I have also noticed this same behavior when exporting to Excel from Crystal, using a vendor desktop application that is written in C++ and uses Crystal XI.
    Does anyone else experience this issue and have a resolution?
    Edited by: Meg Thickman on Feb 3, 2009 8:59 AM

    Hi Meg,
    Just to clarify did you mean viewing the PDF?:
    "Why would/should the file system date change merely by viewing the report?"
    Our exported files are not linked to the master RPT file.
    As I indicated the XLS file is likely in an older format and Excel is detecting and updating something which the file system then detects a change and updates the date stamp. Or excel is writing something back to the file. Did you notice if the file size changed or possibly the byte hash?
    This is not something we are going to be able change. For compatability reasons we cannot stop Excel from updating the file.
    As a work around add the Data Date field to your reports and your auditors can use that as the reference. It will reflect the actual date and time the report was run. Or use Excel API's to update the file format once the report has been exported in your code. You may also want to check with Microsoft to see if it's an option in Excel not to update the format or possibly a registry key to disable the option.
    Thanks again
    Don

  • Job Pricing Reports - Exporting to Excel

    Hi,
    I am testing the standard reports that are availabe in Job Pricing from within the portal.  Example the one report Salary Survey Participation, which is a report that is accessed from ERP, the option to Export to Excel is not working.  In the selection screen if I choose the Output format 'Spreadsheet' I get the error message 'It is not possible to download Excel in the WebGui.  If I then change the Output format to 'SAP List Viewer' then choose the from the Menu - List - Export - Spreadsheet nothing happens.  If I also select 'Print Preview' and then 'Spreadsheet' nothing happens.
    Thanks

    Please re-post if this is still an issue or purchase a case and have a dedicated support engineer work with you directly

  • Time Data Type when Exporting to Excel

    Hello,
    I have a report I wrote using crystal reports XI. There is a datetime field which I converted to a time field through the use of a formula and the time function.  When I right click on the field and view the data type it says time.
    However, when I export to excel the field comes up as a custom field.  How do I get it so that the exported field will appear as a time field in excel?
    Thank you for your help.

    >
    Vitaly Izmaylov wrote:
    > As far as I know, Crystal Reports does not export field type - only data.
    >
    > MS Excel defines the type by reviewing first top records and there is a knowledge base article on Microsoft website on this subject.
    >
    > Could you please give us an example how your time fields look like in Crystal Reports?
    The time looks like this:
    21:38
    10:53
    00:14
    Thanks,
    Athalia

  • Getting exporting to excel gives a run time error.

    Hi,
    I am getting exporting to excel gives a run time error.
    <outbind://127/cid:656371011@08092010-11C9>
    while exporting a query to excel from bw
    Regards
    Karan

    Not sure why this thread bubbled up, but for more recent advice on this topic see Troubleshooting issues with iTunes for Windows updates.
    tt2

  • Audit log trimmer timer job

    HI
    Audit log trimmer timer job
    what this job do 
    I set the sitecollection audit settings to trim the audit data after 7 days 
    is this job before delete it generate Excel report and save in document library?
    adil

    The job 'Trims audit trail entries from site collections.'
    It runs by defualt every month, which means you need to adjust the schedule so that it runs weekly so that it'll pick up your accelerated audit rules.
    This is the job that exports the data to Excel and cleans up the entries from the database.

  • SQL 2008 R2 Export to Excel 2007

    I want to export data using the Import and Export Utility to Excel 2007.  
    I choose a destination of Microsoft Excel and choose an existing (empty) Excel 2007 .xlsx file. 
    The following errors result.  A new worksheet is created in the Excel file with the name of the table and with column headings but no data.  If I repeat the export choosing the now existing Excel file it works fine.
    How can I make it work the first time?
    - Pre-execute (Error)
    Messages
    Error 0xc0202009: Data Flow Task 1: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80040E21.  (SQL Server Import and Export
    Wizard)  
    Error 0xc0202025: Data Flow Task 1: Cannot create an OLE DB accessor. Verify that the column metadata is valid.  (SQL Server Import and Export Wizard)  
    Error 0xc004701a: Data Flow Task 1: component "Destination - RELEASE_LOG" (58) failed the pre-execute phase and returned error code 0xC0202025.  (SQL
    Server Import and Export Wizard)  
    - Executing (Warning)
    Messages
    Warning: Preparation SQL Task 1: Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done. (SQL Server Import
    and Export Wizard)  
    Warning: Preparation SQL Task 1: Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done. (SQL Server Import
    and Export Wizard)  

    Thanks for your reply.
    I think the datatypes are correct.  
    This is the sql for the SQL 2008 table:
    CREATE TABLE [dbo].[q_table](
    [Q_No] [nvarchar](40) NOT NULL,
    [data1] [nvarchar](255) NULL,
    [data2] [nvarchar](255) NULL
    ) ON [PRIMARY]
    This is the sql for the Excel table create.
    CREATE TABLE `q_table` (
    `Q_No` LongText,
    `data1` LongText,
    `data2` LongText
    There is only one row in the table:
    Q_No data1
    data2
    2 444 aaa
    The same export works fine if I select .xls (Excel 1997-2003).  This error happens with every table I try to export to .xlsx.  I created this table and export to try to debug the issue.
    We do this sort of export all the time and I want to use 2007 becuase we often have more than 65K rows to export.  Now we export to Access and then export to Excel but it adds time to the job.

  • Import data from table,export to excel----URGENT

    Dear all ,
    I have a requirement of importing data from database table and then export those data to excel. that means irrespective of column number and row number present in the table,i have to export that table's records to excel. In my from i have text field, by which user will enter table name, it will validate whether DB have that table....if that table present in DB , i have to export it's data to excel..............
    any kind of help and suggestion is welcome

    Welcome to the Oracle Forums. Please take a few minutes to review the following:
    <ul>
    <li>Before posting on this forum please read
    <li>10 Commandments for the OTN Forums Member
    <li>Announcement: Forums Etiquette / Reward Points
    </ul>
    Please provide us with your Forms version, Java version and Client OS version. This information is needed in order to offer you potential solutions. Performing this task in Forms 6i (Client/Server) is completly different than in Forms 9i/10g/11g.
    With respects to your "Urgent!" request. You have to understand that forum contributers are all volunteers - this is not our full-time job. If your issue is truely urgent, it is always best to open a Service Request (SR) with Oracle Support than to rely on the forum for an urgent reply! ;-)
    Craig B-)
    If someone's response is helpful or correct, please mark it accordingly.

  • Matrix exporting to excel with empty columns, with page break option of "Between each instance of a group" selected.

    I am working with Report Builder 3.0 I am using a matrix to produce grouped data on separate worksheets in excel.
    The select is:
    SELECT ID, Measurement, Value, [Date] FROM Measurements_Report. (please ignore the underscores they are just for formatting) 
    The contents of the Measurements_Report table:
    ID__Measurement__Value__[Date]
    1___Hot_________33_____10/1/2014
    2___Hot_________44_____10/2/2014
    3___Cold_________55_____10/2/2014
    The matrix contains a single row group based on the field "measurement". The Measurement group has the page break option of "Between each instance of a group" selected. 
    There is a column group based on the field "Date". 
    When this is matrix is exported to excel on the first worksheet (Hot) there are three columns as shown below:
    ID__10/1/2014____10/2/2014___10/2/1014
    1___33
    2_______________44
    Notice the last column doesn't have a value.
    On the second worksheet (Cold) there are also three columns as shown below:
    ID__10/1/2014___10/2/2014___10/2/1014
    3__________________________55
    This time notice there is only one row and only a value in the last column.
    I only want the columns with data for that worksheet to show up. How can I remove these empty/duplicate columns? Hopefully there is a simple fix. Thanks ahead of time.

    With the following contents of the Measurements_Report table:
    ID__Measurement__Value__[Date]
    1___Hot_________33______10/1/2014
    2___Hot_________43______10/1/2014
    2___Hot_________44______10/2/2014
    3___Cold________55______10/2/2014
    Returns on the first tab (Hot):
    ID__10/1/2014____10/1/2014____10/2/2014
    1___33
    2_________________43
    2______________________________44
    In the excel worksheet it contains a separate column for each date with a value. Thanks again!
    Why is the same date repeating on multiple columns? Do you've the time part also returned from database?
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Export to Excel Issues

    We just upgraded from Crystal 8.5 to Crystal 10.  When we export to Excel, the formatting is terrible.  We have close to 100 reports that we routinely export...some with 40,000 rows.  To try to fix these once they're in Excel is out of the question.
    In previous threads I've been reading about a "patch" that supposedly fixes this.  Where can I download this?
    Eric Hill

    The way reports work and export changed significantly in CR 9. While there was a dll available to help move from CR 8.x to CR 9, that dll is no longer available. Not for CR 9, nor any other versions of CR. Instead, you will have to modify your reports as per the article [Crystal Reports Designer Version 10 Exporting to Microsoft Excel|http://www.sdn.sap.com/irj/boc/go/portal/prtroot/docs/library/uuid/10d3ba69-951e-2b10-3093-e3cf287a57c9?quicklink=index&overridelayout=true].
    No other work-arounds or options exist at this time.
    Ludek
    Follow us on Twitter http://twitter.com/SAPCRNetSup

  • Cross-Tab Report export to Excel

    I have a cross-tab report that I need to export to excel and keep the same formatting.  When I export the report the first column is Part # the next is operation #.  The report is grouped on Part number, but each part may have multi operation.  When I look at the report in Crystal or as a PDF the part # is at the top then each operation is a seperate row that follows.  When I export it to excel it works fine but instead of the part # appearing at the top then follow by each operation the part number ends up on the last operation in the list.  How can I export this and keep the format the same?  by the way I have tried both xls data only and xls 2007 options

    Hello Experts,
    I also tried to export the CR cross tab report in Excel Data only format.
    Also I want to display Row label i.e. my Rows are different dates so I created a text field and named as Date & Time but when export it to Excel Data Only, the date time label appears 1 row above then rest of the columns. It works good while looking on InfoView but export messed it up.
    Can you please suggest.

Maybe you are looking for

  • Problem with reinstalling os x tiger

    I am attempting to reinstall my operating system to get the laptop back to factory condition. When putting the install disc in and starting the install process I click restart. Then the computer restarts and the process immediatly goes to a screen as

  • Apple TV and External HDD

    I'm running out of space for the movies on my internal HDD. I purchased an 40G ATV (the 160 was out of stock) and I intended to store the movies there. Since 40G is too low, I wanted to connect an external HDD to the ATV. Is this possible and if yes,

  • PS crashes on startup

    PS opens OK. WHen file is opened it crashes and I get a message saying that PS has quit unexpectedly. My computer is also stalling before it crashes. Another problem is that the computer is slowing down.... wonder if it is all related. Here is my cra

  • New Mail with Attachment option

    Hi all-- When right-clicking on an image or pdf in the Finder, I get a popup menu with an option to compose a new email with an attachment that is listed below the choices to label the document. Mail wants to launch but it's not setup to run and no a

  • Running scheduled tasks even if their time is missed?

    Hi I have some tasks (e.g. iSync-ing to my mobile phone) which I need to schedule periodically, but would like them to run (albeit in a delay) if my Mac happens to be off at the time of their scheduled run. Both cron and launchd jobs seem to ignore a