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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:07:12+00:00 2026-05-18T21:07:12+00:00

how to read an excel file and change its column data type to string

  • 0

how to read an excel file and change its column data type to string
right now i have an excel sheet with column no :10

the data there is been displayed like this

1/5/2010

6/12/2010

i need to change into this format “dd-MM-yyyy”
so that it displays like this.
01-05-2010

06-12-2010

can any one please tel me how to do this.

any help would be really great

  • 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-18T21:07:13+00:00Added an answer on May 18, 2026 at 9:07 pm

    it reads and update the excel file.before doing this do the following steps

    1.Rightclick solution explorer,then select Add Reference
    2.select Microsoft.Office.interop.Excel in .Net Tab
    3. Add this line in your code (i.e) in the NameSpace:

          using Excel = Microsoft.Office.Interop.Excel;
    
    
           string address;
                Excel.ApplicationClass excel = new Excel.ApplicationClass();
                object Missing = Type.Missing;
                FileInfo fInfo = new FileInfo(@"D:\Book1.xls");
                if (fInfo.Exists)
                {
                    Excel.Workbook workbook = excel.Workbooks.Open(@"D:\Book1.xls", Missing, Missing,
                        Missing, Missing, Missing, Missing, Missing,
                        Missing, Missing, Missing, Missing, Missing,
                        Missing, Missing);
                    Excel.Worksheet worksheet = (Excel.Worksheet)workbook.Sheets["Sheet1"];
                    Excel.Range docNumber = worksheet.Cells.Find("10/5/2010", worksheet.Cells[1, 1],
                        Excel.XlFindLookIn.xlValues,
                        Excel.XlLookAt.xlPart, Missing, Excel.XlSearchDirection.xlNext,
                        false, Missing, Missing);
                    if (docNumber != null)
                    {
                        address = docNumber.get_Address(true, true, Excel.XlReferenceStyle.xlA1, Missing,
                            Missing);
                        docNumber = worksheet.UsedRange;
                        DateTime parsedDate;                       
                        for (int rCnt = 1; rCnt <= docNumber.Rows.Count; rCnt++)
                        {
                            for (int cCnt = 1; cCnt <= docNumber.Columns.Count; cCnt++)
                            {
                                string str = (string)(docNumber.Cells[rCnt, cCnt] as Excel.Range).Text ;
                                parsedDate = DateTime.Parse(str);
                                str =  String.Format("{0:dd-mm-yyyy}", parsedDate);
                                docNumber.Cells[rCnt, cCnt] = str;                                
                            }
                        }                        
                        workbook.Save();                        
                    }
                }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have got the following code from here to read an Excel file using
I have to read an excel file through a COM interop. I search for
Now i want to read any excel file that are given by the user
I'm able to connect to and read an excel file no problem. But when
Is there a free or open source library to read Excel files (.xls) directly
I am trying to read data from excel files using datatable. The command select
I need to import some data from a excel file and a folder with
I have a formated Excel file, over which I do not have control, and
I'm trying to read a CSV file generated by M$ Excel on linux. The
I'm trying to read from excel file with oleDB provider using C#: using (var

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.