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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:10:24+00:00 2026-05-29T10:10:24+00:00

I want to insert an Array of characters into one column of Excel. I

  • 0

I want to insert an Array of characters into one column of Excel. I normally use something like this to just add a normal string:

lCommand.CommandText += "\"" + row["source"].ToString().Replace("\"", "\"\"").Replace(" ", " ") + "\",";

How would I add an Array of strings to a Column of Excel? 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-05-29T10:10:24+00:00Added an answer on May 29, 2026 at 10:10 am

    You can open the File with C# and write to the cell you want.

    First :

    using Microsoft.Office.Interop.Excel;
    

    This require you to have COM reference for Excel.

    After this you need to open the file you want and set the value. After, you can close the file.

    Here is an example. You can always loop for each rows or column for your array.

        _Application docExcel = new Microsoft.Office.Interop.Excel.Application();
        docExcel.Visible = false;
        docExcel.DisplayAlerts = false;
    
        _Workbook workbooksExcel = docExcel.Workbooks.Open(@"C:\test.xlsx", Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
        _Worksheet worksheetExcel = (_Worksheet)workbooksExcel.ActiveSheet;
    
        ((Range)worksheetExcel.Cells["1", "A"]).Value2 = "aa";
        ((Range)worksheetExcel.Cells["1", "B"]).Value2 = "bb";
    
        workbooksExcel.Save();
        workbooksExcel.Close(false, Type.Missing, Type.Missing);
        docExcel.Application.DisplayAlerts = true;
        docExcel.Application.Quit();
    

    Edit:

    You can use the Dynamic keyword if you do not want all those Type.Missing parameter :

        _Application docExcel = new Application{Visible = false};
    
        dynamic workbooksExcel = docExcel.Workbooks.Open(@"C:\test.xlsx");
        var worksheetExcel = (_Worksheet)workbooksExcel.ActiveSheet;
    
        ((Range)worksheetExcel.Cells["1", "A"]).Value2 = "test1";
        ((Range)worksheetExcel.Cells["1", "B"]).Value2 = "test2";
    
        workbooksExcel.Save();
        workbooksExcel.Close(false);
        docExcel.Application.Quit();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to Java. I want to create Java Array and insert data into
how to insert special characters into a database(MySQL) like Registered symbol ( ® )
I want to insert a 2 dimensional array into a DB table. Is there
I want to insert the result of a query into a javascript array. I
i want to insert the values of two arrays into a table in a
I want insert a custom snippet into an XML file from code within an
I want to insert a record into a MySQL database table from a formulaire.
I want to insert the following include tag into my webpage using JavaScript. <!--#include
I want to insert widgets into my ItemsControl and make them resizeable. How do
i want to insert all processes that running into listbox, and also how to

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.