Objective
To retrieve values from Excel sheet that is changing each second.
Efforts so far
Created shared excel file so that it can be retrieved by more than two processes simultaneously.
Tried to read excel file that is receiving updates from RTD Server. The file is changing cells values each second. I read it by using Microsoft.Office.Interop.Excel
Simultaneously accessing data from excel file into GridView using System.Data.OleDb.
Looking for
How to read those dynamic values from excel sheet? Because until those values are not saved, I can't read them from code they way I am doing now.
I believe that there should be way for accessing those changing values in cells. But I am not gettig any hint.
Related
I have been successful exporting the data to CSV, but now the user wants it to be in an Excel sheet without having to import using CSV. I figured out how to create the headers, but now need to iterate through about 44,000 rows of data placing it in Excel. I looked on here for a answer I could use, but didn't find anything yet, that was useful for what I need to do.
I already have my DB connection, just not sure how to write the loop to export to excel.
I have scenario where I have to prepare two batch of excel files. I have two templates. I am automating a process. The 1st Excel file has formulas in it. I populate data using C# winform and OpenXML library in the first excel file. I want to have the formulas calculate results and then grab them to populate the 2nd excel file. I have tried various methods but was unsuccessful. I did use the following code hoping it will make the excel file calculate the formulas in it.
SpreadSheetDocument.WorkbookPart.Workbook.CalculationProperties.ForceFullCalculation = true;
SpreadSheetDocument.WorkbookPart.Workbook.CalculationProperties.FullCalculationOnLoad = true;
So basically the process should be
Make copy of the 1st excel file and populate it with data [This part is working]
Some how make the 1st excel file data calculate the formulas [This is the step I have problem with]
Copy the formula results values to the 2nd excel file [This part is working but as formula is not calculated the values are not being copied over]
I am reluctant to use excel interlop library as closing the excel does not work as well.
I have an Excel report generation app using EPPlus. In one of sheets the formulas are getting dynamically updated, formulas referencing other sheets data. When I open the generated report I am able to see the formulas but the data is getting reflected only when I manually save the Excel sheet.
The reference sheet was also dynamically added, but when I changed it to static sheet the issue persisted.
Do I need to call some other function to update the formulas?
ok got it.
I need to call
package.Workbook.Calculate()
I have an Excel template which has dynamic rows and columns (it means the Excel template will be downloaded based on the parameters I select in my UI). Now there will be some data in the Excel sheet against those dynamic rows and columns coming from the database. I want to modify that Excel and import it so that only the updated(modified) cell values are updated in database. I thought a lot and I think this can be done with macros (by changing the color of cells with updated values and picking them up from C#). I would welcome any other thoughts/approaches for this.
An approach I have used is to create a webdav/REST service which can then be mounted as a drive in Windows.
The exposed file on the webdav service was simply a CSV, which users could edit in Excel, but the GET request was serviced by reading the database.
After making the changes, the user saved in Excel, which caused a PUT on the webdav service. The PUT request wrote the new values to the database.
I have an automated test which produces a csv with two columns of data.
I have an excel file which I use to gather the results of all the runs in a worksheet.
I want to fully automate the process of updating the Excel file after each test run.
This is probably what I want to do:
1. Read the two columns from the CSV file
2. Paste the two columns in a worksheet in the excel file, in the first
empty column to the right of the existing block of columns.
3. Save the Excel file
EDIT:
Now i understand that i can do steps 1-3 using a macro.
All that is left for me to figure out is how to launch the macro.
You can read the csv and write to the Excel sheet with a single data provider, the OleDb provider. Here is an article on how to write to Excel, and here is one on how to read csv.
Once you write the macro, it should be in the macro list in Excel for that Excel document. You can bind the macro to a keystroke (like Alt-i, Alt-whatever) so that it runs when your press that key combination.
I've done this on a couple of similar projects where I need to import CSV files from other sources and put the data into an Excel sheet (or sheets)