none
Refresh data in excel after changing data in sql server in C# web application RRS feed

  • Question

  • I have a web application that get data of stored procedure of sql then export this result to excel.
    i want after change data of sql without new export to excel only with open old file update with new data.
    please help me.
    • Moved by CoolDadTx Wednesday, April 15, 2015 6:25 PM Office related
    Wednesday, April 15, 2015 11:14 AM

All replies

  • I have a web application that get data of stored procedure of sql then export this result to excel.
    i want after change data of sql without new export to excel only with open old file update with new data.
    please help me.
    • Merged by L.HlModerator Thursday, April 16, 2015 2:18 AM repeat thread
    Wednesday, April 15, 2015 11:11 AM
  • Are you triggering that there are data changes happened? If yes, how?. Are you viewing this data in a UI, or its just a file where the user has to open?

    Fouad Roumieh

    Wednesday, April 15, 2015 12:19 PM
  • Hi Fouad

    thanks for your reply 

    i want to create a button in excel that trigger c# function to update data, if it is possible ,or set connection in excel to connect to asp.net application via web service. 

    user export my Grid to excel via UI and i want to user could update data this local old excel file every time that open it or press button .

    is it any solution for my problem?


      

     
    Wednesday, April 15, 2015 12:48 PM
  • I'm still not getting your full scenario, we will suggest how but tell us what?. Is it a web page with a DataGridVeiw on it and you want to convert to Excel file?. Or it is an excel file that is connected to the DB?

    If you have screen shots of you webpage, please post it. We want to check if what you looking for is a C# code functionality or asp.net.

    Please answer above questions clearly.


    Fouad Roumieh

    Wednesday, April 15, 2015 1:05 PM
  • I have SP in Asp.net with C# language that Result is  a DataGrid on my Web Application. user can Export to excel this DataGrid via UI.

     So I want to Update old Excel file with new data according changing in DB tables. 


    Wednesday, April 15, 2015 1:26 PM
  • If the user is able to generate the excel from the DataGrid, then he/she is able to get the latest data in the Datagrid by refreshing and clicking export again, What I am missing here?

    You saying "to Update Old Excel" which one is this? is it the one exported last time by the user?


    Fouad Roumieh

    Wednesday, April 15, 2015 3:53 PM
  • This is really a question for an Excel forum as there's no way to do this without some support from Excel itself.

    If you look in the Data tab of Excel you'll see a From Web button. That allows you to select a HTML table from a web page and Excel will extract the data from that table and put into the spreadsheet. After that you can press the Refresh button from the same tab to tell Excel to update the table.

    I don't know how you can produce a Excel file that has such a data connection, that depends on the way you export the Excel file in the first place. If you're using a 3rd party library for export consider asking this in the 3rd party support forums (assuming that they have forums).

    Wednesday, April 15, 2015 4:41 PM
  • I'm not sure what you're asking for.  Do you want to import data from SQL Server into Excel, or import data from the web into Excel?  If the data in the web site is coming from the DB, it's definitely easier, and overall more efficient, to import it into Excel directly from the DB.  Here's a link with several VBA code samples that show how to suck data into Excel from SQL Server.

    http://www.excel-sql-server.com/excel-sql-server-import-export-using-vba.htm#Introduction


    Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.

    Wednesday, April 15, 2015 5:03 PM
  • Fouad Roumieh ,I export data grid to excel in visual studio and after that i dont want to export it again just by refreshing that excel ,i want data will be updated according to DB (that data is report and is not exact table of DB and data make by SP then i dont want to connect my excel to DB), do you want to explain more?

    • Edited by Farinaz K Saturday, April 18, 2015 6:10 AM
    Saturday, April 18, 2015 5:04 AM
  • Mike Danes thanks for your reply , i have a web application that can export data Grid of one page to excel, how i can use from web button to load my data grid , this button of excel gets just address of web and have button for import it . i test it by rest API project , but dosnt work, do you know how it is work?

     



    • Edited by Farinaz K Saturday, April 18, 2015 6:12 AM
    Saturday, April 18, 2015 5:33 AM
  • hi,

    >> this button of excel gets just address of web and have button for import it

         i test it by rest API project , but doesn't work, do you know how it is work?

    Do you mean that you don't know how to get the table? You may input the site address into the address box, and then click go button nearby, select the table you want to import into the Excel. Then click import button.That also works for  rest API, and your rest API should get the data that you want

    By the way, this is the forum for discussions about Excel develop(VBA ,customization), better to go to TechNet forum for Excel for Excel features question, so that you could get more professional help.

    Best Regards

    Lan


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Wednesday, April 22, 2015 5:04 AM
    Moderator