Populate cells dynamically by column headings

I attach both the Test777.xlsx (which is just an empty workbook) and the runnable project sample (console app) . Just run the console, will trigger file -> don’t close the file and run again the console app (can run the console multiple times, keeping the file open always)Test777.zip (5.2 KB)
SampleProject1.zip (5.5 MB)

@Remus87,

Thanks for the sample file and project.

I did open your sample project into VS.NET 2015 while setting/adding reference to latest version/fix: Aspose.Cells for .NET v21.11. I then run the project and got the same error which I already told you with complete details in one of my previous reply. See the attached screenshot of the error for your reference.
sc_shot1.png (98.5 KB)

I will again paste some of the contents of the reply here.

By the way, to cope with the error, one way can be, you may re-save the file with different/unique name.

I’m using Aspose.Cells for .Net 21.5 in VS.NET 2019 Runtime version=“v4.0” and .NETFramework version 4.6.1.
You shouldn’t get the error as you’re ending the Test777.xlsx Process in the first 2 lines of the TestWorkbook() method
And on the last line you detach the Process from the Application.
So i am able to run each time the program with the Test777.xlsx open, and each time it keeps adding to the Document Recovery toolbar a new version of the file. See screen shotSample_ProcessOpened.PNG (21.2 KB)

@Remus87,

You provided your sample project and you asked to download and try your exact project to get your issue. We did run your exact project (as we supposed to do) and got the error we mentioned in our previous reply. Anyways, I deleted the first two lines and last line in the method and re-run it. On the second run, I got the same issue. See the attached screenshot.
sc_shot12.png (95.2 KB)

Please note, you cannot re-save an Excel file with same name while it is already opened in Excel (because the output file is already a part of the Excel process). You have to close the file from MS Excel or save with different name. For confirmation, please do not use Aspose.Cells APIs and use only System.IO APIs to read and write the file (while the file is opened into MS Excel) and you should get the same error.

Yes the whole idea is to run my provided project and replicate the same exact behaviour.
Regarding the lines of code (2 lines at front and the last line) i just wanted to showcase that the error should not occur exactly because you have those lines present in the method.
Otherwise is normal that the error message should occur. So you should not comment at all those lines.
Step by step:

  1. Run the program
  2. Rerun the Program (without doing any action as closing the Test777.xlsx process)
  3. Repeat step 2

@Remus87,

It looks you want MS Excel recover the file with the newly imported data/records automatically. We are very sorry but this is impossible. We should not and in fact, cannot modify the temp files maintained (in the process) and locked by MS Excel. We are afraid there is no way for us to support such kind of requirements. If you still think it is possible, you may provide us the sample code but without using our APIs, e.g., just use an existing Excel file with some demo data with your own code to achieve your goal. We can check whether we can simulate this behavior with our component.