Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9195959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:44:40+00:00 2026-06-17T21:44:40+00:00

I have most of the problem solved. I can loop through the worksheets, I

  • 0

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!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T21:44:41+00:00Added an answer on June 17, 2026 at 9:44 pm

    Something like this, not tested. See http://dontbreakthebuild.com/2011/01/30/excel-and-c-interop-with-net-4-how-to-read-data-from-excel/

    using (StreamWriter sw = File.CreateText("ExtractedText.txt"))
    {
        var excelApp = new Excel.Application();
        var workBook = excelApp.Workbooks.Open(thisFile);
    
        foreach (var sheet in workBook.Worksheets)
        {
          foreach (var row in sheet.UsedRange.Rows)
          {
            foreach (var cell in row.Columns)
            {
              sw.Write(cell.Value + " ");
            } 
            sw.WriteLine();
          }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok I seem to have got the most of the problem solved, I just
I have encountered a most annoying problem that occurs on the PWD variable when
well i have most probably an extremly stupid problem but could not figure it
Problem I have a list of view models. Most of the view models have
Quick one. I'm using mod rewrite and have most replacements in place: empty space
I have spent most of my web-development career in the Microsoft camp, but for
I have the most bizarre bug, where clicking a listbox item makes the listbox
I have the most basic jquery function of them all, but I couldn't find
I have studied most of the posts concerning web page being viewed in an
I have viewed most of the other threads regarding this error but have not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.