title: Import from excel to winforms (data not saved) c#
body: <p>there are many examples on the web, how to emport data from an excel file to a winform usind Office.Interop.Excel, wheere excel file is stored on the disk. Here is one simple example: </p>
  
  <pre><code>private void button1_Click(object sender, EventArgs e)
          {
              Excel.Application xlApp = new Excel.Application();
              Excel.Workbook xlWorkbook = xlApp.Workbooks.Open(@"C:/Users/1/Desktop/test2.xlsx");
              Excel._Worksheet xlWorksheet = xlWorkbook.Sheets[1];
              Excel.Range xlRange = xlWorksheet.UsedRange;
  
              int rowCount = xlRange.Rows.Count;
              int colCount = xlRange.Columns.Count;
  
              for (int i = 1; i &lt; rowCount+1; i++)
              {
                  for (int j = 1; j &lt; colCount+1; j++)
                  {
                      textBox1.Text= (xlRange.Cells[2,2].Value2.ToString());
                      textBox2.Text = (xlRange.Cells[2, 3].Value2.ToString());
                  }
              }
          }
  </code></pre>
  
  <p>Unfortunataly I could not find, how to export data, when the excel file is already open, and the data from a thread is loading into the spread sheet, and the numbers in cells are changing every second. In the code above only the last saved data is seen in the textbox. Is there a solution for my problem?</p>