Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 944313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T22:34:23+00:00 2026-05-15T22:34:23+00:00

I have an DataTable I need to put into Excel 2007 format and save

  • 0

I have an DataTable I need to put into Excel 2007 format and save it as an excel file(.xlsx) 2007.

Can anyone help me to achieve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T22:34:24+00:00Added an answer on May 15, 2026 at 10:34 pm

    You can use an OLEDB data provider and just treat Excel as another ADO.NET data source in order to loop through your DataTable rows and insert them into the Excel spreadsheet. Here’s a Microsoft KB article that walks you through a lot of the details.

    http://support.microsoft.com/kb/316934/en-us

    The big thing to keep in mind is that you can create workbooks and sheets within the workbook, and you can reference existing sheets by appending a ‘$’ at the end of the name. If you omit the ‘$’ at the end of the sheet name, the OLEDB provider will assume that it’s a new sheet and will try to create it.

    The dollar sign following the
    worksheet name is an indication that
    the table exists. If you are creating
    a new table, as discussed in the
    Create New Workbooks and Tables
    section of this article, do not use
    the dollar sign.

    You can create and spreadsheet in 2003 (.xls) or 2007 format (xlsx), and that’s defined on your connection string — you specify the file that you’re going to write to, and just specify the extension. Make sure you use the right OLEDB provider version.

    If you want to create a 2003 (.xls) version, you use this connection string:

    Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Book1.xls;Extended Properties="Excel 8.0;HDR=YES
    

    If you want to create a 2007 (.xlsx) version, you use this connection string:

    Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Book1.xlsx;Extended Properties="Excel 12.0;HDR=YES
    

    You may have to download the ACE provider from Microsoft in order to create XLSX files. You can find it here.

    I usually use the XLS provider, so I haven’t worked with the XLSX provider as much.

    Hope this helps. Let me know if you have other questions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have DataTable object. How can I export it into an XLS file? I
I need to parse a string from a datatable into a double. I have
I have datatable with column name tag and 100 rows of data.I need to
I have a task where I need to translate a DataTable to a two-dimensional
I have a dropdown. I need to bind with two field of datatable value
I have an table. I need to iterate, for each(datarow r in datatable.rows){ foreach(datacolumns
I have a .Net windows forms application, and I need to load values into
What i need id to take the first column of an excel file and
I need to marge two datatables with condition. I have a datatable where the
I have a datatable with some rows I need to insert that datatable in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.