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 7129875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T11:17:23+00:00 2026-05-28T11:17:23+00:00

I need to make an excel file which would fetch data from connection to

  • 0

I need to make an excel file which would fetch data from connection to ms sql table. At the moment, I am exporting the data to xml (through mvc 3 page), and then getting it into excel this way: http://xignite.web-services-blog.com/2011/03/how-to-import-market-data-into-excel-using-xml/ .

I don’t want to simply generate excel file with data, as I want user to be able to hit refresh button in excel and fetch fresh data at any moment in time. My problem is, there can be up to 100 000 rows, and excel is really slow at parsing xml files this way, it locks whole cpu core for minutes. It’s impossible to use it.

Are there any more optimized way to achieve this? I could try fetching the data directly from ms sql, but I don’t want the user to be able to read the whole table – he should be able to read only “his” rows. That’s why currently I’m using xml – I can include his login in the link, and then only return rows that he has access to. If I would give him access to ms sql, I’d have to create separate logins and views for each client, which would be a pain to automate… Besides, I’m unsure how much faster would that be?

Sorry for the unclear description – I’m not exactly sure what this way of importing data to excel is called, and couldn’t really find much about it either.

  • 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-28T11:17:23+00:00Added an answer on May 28, 2026 at 11:17 am

    If you are already using a web server to generate the XML file, then consider generating a CSV file on the fly from the database. The user can then import data from this CSV file. This would work as following:

    1. User opens his spreadsheet and clicks Refresh.
    2. User’s Excel connects to a URL, say http://intranet/report.csv?username=Bob.
    3. Web server connects to SQL server and executes a query.
    4. Web server creates a MemoryStream ms object.
    5. Web server uses DataReader or SqlDataReader to read query result and writes it to ms in CSV format (comma-separated values).
    6. Web server responds with Content-disposition: attachment; filename=report.csv header and sends CSV to user using Response.BinaryWrite().
    7. User’s Excel receives report.csv and uses it refresh the contents of the user’s spreadsheet.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This code exports data into a csv file, which is opened within Excel. When
Basically I need to insert a bunch of data to an Excel file. Creating
I need to create an excel file from scratch in VB.NET given a DataTable
I am writing some data from database to the excel via visual basic.net.I need
I need to restrict users from opening an Excel (.xls) file with notepad. I
I have an asp.net application that is exporting data to excel. I need to
There is a list which I would like to output into an excel file
I am using C# and OleDb to read data from an excel 2007 file.
I have a crystal report file I need make a tiny edit in. It
I have a few tests that need to be fed with external data from

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.