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 6190283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:33:38+00:00 2026-05-24T02:33:38+00:00

I am very new to c# although i control all the basics. I essentially

  • 0

I am very new to c# although i control all the basics. I essentially have a byte [] for the y-axis of an accelerometer (up/down) which I called Y[]. I need one line of code to export this to an excel file (I work with Office professional 2003). I would like value Y[0] to be written to cell A1, Y[1] to A2, and so on ( so just one column of data. The purpose of this is to be able to use excel to manipulate the data more easily and be able to plot it. I know there are plotting apps for c# like zed graph but i preffer excel.

I have looked far and wide and havent found anything to help me. All i need to do is create an excel (.xls) file, write on it, save it and close it. But how? Do you use FileStream? or what? please if you understand my problem give me the one or two lines of code i need. I’m so close to finishing this little project!!!

Thanks a lot guys.

  • 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-05-24T02:33:39+00:00Added an answer on May 24, 2026 at 2:33 am

    So, the code I ended up using was the following.
    I had a byte array which i’m not gonna go into details as to how it got it, but it was called AllY []. Then I transformed this into a string array called MyYData [] which held the same values but in string form.

    for (int F = 0; F < (21*SECT); F++)
    {
         Console.WriteLine(AllY[F]);   // Shows the byte array mentioned.
         MyYData[F] = AllY[F].ToString();  // The data is sotred as succesions of strings.
    }
    Console.ReadKey();
    
    Excel.Application excelApp = new Excel.Application();
    excelApp.Visible = true;
    string myPath = @"C:\Documents and Settings\John\My Documents\DATA.xls";   // The main downside to this code, is that the document must exist prior to code execution (but i'm sure you guys can figure out a way for the code to create de document).
    excelApp.Workbooks.Open(myPath);                                                            
    
    for (int r = 1; r < ((21 * SECT)+1); r++)  // r must be set to 1, because cell 0x0 doesn't exist!
    {
         int rowIndex = r;
         int colIndex = 1;
         excelApp.Cells[rowIndex, colIndex] = MyYData[r-1];
         excelApp.Visible = true;
    }
    Console.ReadKey();
    

    Thank you everyone. And i’d like to say that this website works 100 times better than the “official” microsoft msdn crappy site.

    Furthermore, i forgot to add that to use the excel commands you have to add a reference from the project menu > Add Reference > COM > Microsoft Excel 11.0 object (the number may vary). then at the header of the document, add:

    using Microsoft.Office.Core;
    using Excel = Microsoft.Office.Interop.Excel;

    Cheers everyone, and keep it coded!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

[Sorry, I'm new in Python. Although it seems to be a very basic question,
Very new to python and can't understand why this isn't working. I have a
Very new to JQuery and MVC and webdevelopment over all. I'm now trying to
Very new to XSL (and XML for that matter), but I need to step
Im very new in C++ I have found this post http://msdn.microsoft.com/en-us/magazine/cc163486.aspx and trying to
I'm fairly new to using AJAX in ASP.NET (although I am very familiar with
I have just started working with a new company in a very small IT
I have a WindowsForm with a panel control which I use to display my
I have a very simple problem. I have an application which is written in
I am very new to regex, but so far liking it's power. Incredible, although

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.