locked
Issues while opening a UTF16 encoded .csv file in excel using c# RRS feed

  • Question

  • When I tried to open a UTF8 encoded .csv file in excel through my c# code, doing something like this:

    m_excel.Workbooks.OpenText(newPath, Comma: true);

    That works fine. Can anyone tell me what to do if I had to open a UTF16 encoded .CSV file similarly. All options i tried either fails or print incorrect Unicode characters.

    So somehow we have to specify the encoding format (of the file to be opened i.e .CSV)  while opening using excel functions, which i am unable to figure out.
    Please help me. I am badly stuck here.

    Thanks in advance.

    Friday, January 2, 2015 7:04 AM

Answers

  • Hi Jb9952,

    There is an Origin parameter in Workbooks.OpenText method, you need to specify this parameter. You could try to use xlWindows (Windows ANSI).

    To get the specify file origin value, you could get the detail code through Record Macro feature in excel.

    Regards

    Starain


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, January 5, 2015 4:24 AM