20 Comments

  1. I ' ve got a problem. My Excel files do not close , When I 'm using my c# APP . Even When I check the Task Manager , So many Excel File are running . How can I Close all of the excel files after use my program.
    I tried this ways :
    1) public void Close(bool saveChanges)

    {

    wb.Close(saveChanges);

    }

    2) public void Close()

    {

    wb.Close();

    }

    3) public void Quit()

    {

    excel.Quit();

    }

  2. This is a great lesson. Can you please help with a way to fill different cells in different sheets based on a combobox criteria. For example, if combobox is Weekly Inspection, fill cells[0,0] of ws 1. If its monthly inspection, fill ws 2 cells.

  3. This is an excellent series of tutorials.

    How can we write something that was entered by a user in a textbox into selected cells in an existing excel sheet. For example, 3 textboxes to be filled in by user, then on OK button click it needs to write that to specified cells in specified sheet.

  4. Hi thank you for the tuto, but i want to use excel formula, so instead of ws.Cells[i,j].value2=s
    i used ws.Cells[i,j].formula="=left(A1;7)" but it doesn't work, please do you know where is the problem ?

  5. BIG BUG AGAIN….. every time you run you application it leave open Excel process in windows !!!!! You must close that process from you application or your sistem will crash…..

  6. Hi, thanks for your tutorials, it helped me a lot.

    Though, i have some issues saving those files.
    1.
    When i try your example, i'm specifying a path which is not the default one (Document).
    Let's say it's Resources in my project Folder.
    Ok so, the thing your code does is actually creating a new file in Document, with the original datas + the one i wrote.
    But it doesn't write on the existing file.

    2.
    When i try to check for the changes the code do, i got a Write Only error, like the programme i wrote do not actually close the file effectively.
    Windows still thinks that my programm has the file opened and won't let me alter it.

    Might be that the 1. error is coming from that error : programm can't write in the "original" file concidered as "already opened" and then, writes a new one in the default @folder ?
    Isn't there some kind of "Instance" to close as well ?

    Any ideas ?

  7. Thanks for putting these examples/tutorials out. Very helpful. I do have a request. Can you do a tutorial in adding multiple rows of data into Excel? I'm looking into an exercise in SQL data from one database (cross platform) into excel and having trouble figuring out the excel piece. So for an example you have 4 fields, 50 records, you want mapped into Excel. Using SQL to query the database results, how would you output those results into Excel using C#?

Leave a Reply

Your email address will not be published. Required fields are marked *