I have solved most of the problem. I can scroll through the sheets, I can create a text file and write to it. The only problem I ran into is extracting text or values ββfrom each sheet. Below is the code, but it only throws the object onto the worksheet and writes these words to a text file instead of the actual values.
System.Object[,]
System.Object[,]
What else am I missing? I must indicate that I am a beginner programmer.
Here is the code that I still have:
using (StreamWriter sw = File.CreateText("ExtractedText.txt"))
{
Excel.Application xlApp = new Excel.Application();
Excel.Workbook thisWkBook = xlApp.Workbooks.Open(thisFile);
foreach (Excel.Worksheet sheet in thisWkBook.Worksheets)
{
sw.WriteLine(sheet.UsedRange.Value);
}
}
Any ideas? Thank!
source
share