I have most of the problem solved. I can loop through the worksheets, I can create the text file and write to it. The only problem I'm having is actually extracting the text or values from every sheet. Below is the code I have, but it only throws an object per worksheet and writes those words into my text file instead of the actual values.
System.Object[,]
System.Object[,]
What else am I missing? I should point out I'm a beginner programmer.
Here's the code I have so far:
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? Thanks!