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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:59:39+00:00 2026-06-17T10:59:39+00:00

I have a ribbon that i made for Excel along with a cs File

  • 0

I have a ribbon that i made for Excel along with a cs File to perform as the core of the add-in.
When a button is clicked on the CustomRibbon I want to parse the data values for one of the rows.

    private void button1_Click(object sender, RibbonControlEventArgs e)
    {
        Console.WriteLine(Globals.ThisAddIn.Application.Cells[0, 0]);

    }

But that gives me an error

Exception from HRESULT: 0x800A03EC

All i want to do is to be able to parse the data from cells on my worksheet and write data to the worksheet. Even on the startup of my program when i do:

        sheet.Cells[0,0]= "hello";

It gives me an error as well.

  • 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-17T10:59:40+00:00Added an answer on June 17, 2026 at 10:59 am

    The “lowest” applicable index for referring to a cell in an Excel sheet is [1,1], which corresponds to Column A, Cell 1. I see you’re trying to refer to 0,0 which is out of the bounds of the table.

    Though C# typically utilizes zero based table indexing, it appears the programmers of Excel Interop adhered to a different methodology. That or they wanted to keep their conventions uniform, since the first row in an Excel table starts with 1, and not 0. I’m not an Excel buff, but that’s my best guess.

    Edit: Per Siddharth’s request, here’s an example that copies the contents of a DataGridView control to an Excel sheet. Note that this just demonstrates basic functionality, and isn’t a complete example or necessarily best practice:

    #using Microsoft.Office.Interop;
    
    Excel.Application xlApp;
    Excel.Workbook xlWorkBook;
    Excel.Worksheet xlWorkSheet;
    
    xlApp = new Excel.ApplicationClass();
    xlWorkBook = xlApp.Workbooks.Add(1);
    xlWorkSheet = Excel.Worksheet xlWorkBook.ActiveSheet;
    
    // Notice the index starting at [1,1] (row,column)
    for (int i=1; i<DataGridView.Columns.Count+1; i++)
        xlWorkSheet.Cells[1, i] = DataGridView.Columns[i - 1].HeaderText;
    
    for each(DataGridViewRow row in DataGridView.Rows)
    {
        for each (DataGridViewColumn column in DataGridView.Columns)
        {
            xlWorkSheet.Cells[row.Index+2,column.Index+1] = DataGridView.Rows[row.Index].Cells[column.Index].Value;
        }
    }
    

    Notice the disparities between the indexing. This example first copies the headers from the DataGridView, then offsets the position in the Excel sheet to copy the rest of the data since the column headers don’t count as index-able cells in the DataGrid. This would probably also work for DataTables.

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

Sidebar

Related Questions

I have made an Excel Add in (Ribbon). When i run the .vsto and
I have a custom ribbon button on one of my CRM 2011 entities that
I've created an add-in for outlook 2010. I have a ribbon that has a
I'd like to create an Excel Add In. But I want it to have
I'm using the WPF Office Ribbon, and I have a content view that I
I have an MFC-based app that uses the Office 2007 ribbon interface. MFC is
Does Microsoft have ribbon control for non-Office applications? If not is there any that
I have a button on the ribbon of the contactgrid in microsoft dynamics crm
In Sitecore, I have users who are using the editing ribbon to add content
I want to have/define a unique id for each data row in my Excel

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.