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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:14:19+00:00 2026-06-13T13:14:19+00:00

I have a file i receive from a blackbox system, the file is somehow

  • 0

I have a file i receive from a blackbox system, the file is somehow mixed between xml and excel, when i open the file with excel i get first a warning message, and if i open it with text editor, the following xml head is:

<?xml version="1.0" encoding="UTF-8"?>
    <?mso-application progid="Excel.Sheet"?>
    <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
        xmlns:o="urn:schemas-microsoft-com:office:office"
        xmlns:x="urn:schemas-microsoft-com:office:excel"
        xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
        xmlns:html="http://www.w3.org/TR/REC-html40">

        <Styles>

                <Style ss:ID="Default">
                    <Alignment ss:Horizontal="Left" ss:Vertical="Bottom" />
                    <Borders/>
                    <Font/>
                    <Interior/>
                    <NumberFormat/>
                    <Protection/>
                </Style>
                <Style ss:ID="sHeader">
                    <Alignment ss:Horizontal="Left" ss:Vertical="Bottom" />
                    <Font ss:Bold="1"/>
                    <NumberFormat ss:Format="@"/>
                </Style>

i tried many solutions includes (first try to import the file to DataGridView then export it to csv however i always get Unrecognized database format

First, what kind of xls mixed with xml file is this? how can i remove all these head information and just have a simple csv file?

UPDATE:
I found a way to load data from this excel-XML file however i recieve all data in one column

this is the code i used:

 XmlDocument xml = new XmlDocument();
            string filePath = @"C:\temp\test.xml";
            xml.Load(filePath);
            XmlNamespaceManager nsmgr = new XmlNamespaceManager(xml.NameTable);
            nsmgr.AddNamespace("ss", "urn:schemas-microsoft-com:office:spreadsheet");
            XmlElement root = xml.DocumentElement;
            XmlNodeList nodeList = root.SelectNodes("//ss:Data", nsmgr);
            dataGridView1.DataSource= ConvertXmlNodeListToDataTable(nodeList);


public static DataTable ConvertXmlNodeListToDataTable(XmlNodeList xnl)
        {

            DataTable dt = new DataTable();

            int TempColumn = 0;



            foreach (XmlNode node in xnl.Item(0).ChildNodes)
            {

                TempColumn++;

                DataColumn dc = new DataColumn(node.Name, System.Type.GetType("System.String"));

                if (dt.Columns.Contains(node.Name))
                {

                    dt.Columns.Add(dc.ColumnName = dc.ColumnName + TempColumn.ToString());

                }

                else
                {

                    dt.Columns.Add(dc);

                }

            }

            int ColumnsCount = dt.Columns.Count;
            for (int i = 0; i < xnl.Count; i++)
            {

                DataRow dr = dt.NewRow();

                for (int j = 0; j < ColumnsCount; j++)
                {

                    dr[j] = xnl.Item(i).ChildNodes[j].InnerText;

                }

                dt.Rows.Add(dr);

            }

            return dt;

        }

    }
  • 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-13T13:14:20+00:00Added an answer on June 13, 2026 at 1:14 pm

    I found a solution:

    Use microsoft name space to load the xls-xml file
    Get xmlNodeList

    Please Notice that in my region we are using semicolon as separator

    public static XmlNodeList ParseExcelEXMLFormat(string filePath)
       {
           try
           {
    
                XmlDocument xml = new XmlDocument();
                xml.Load(filePath);
                XmlNamespaceManager nsSchema = new XmlNamespaceManager(xml.NameTable);
                nsSchema.AddNamespace("ss", "urn:schemas-microsoft-com:office:spreadsheet");
                XmlElement root = xml.DocumentElement;
                XmlNodeList nodeList = root.SelectNodes("//ss:Data", nsSchema);
                return nodeList;
           }
           catch (Exception)
           {
    
               throw;
           }
       }
    

    then convert XmlNodeList to StringBuilder

     public static StringBuilder XMLNodeListToStringBuilderConverter(XmlNodeList xmlNodeList, string separator)
       {
           try
           {
               StringBuilder sb = new StringBuilder();
               DataTable dt = new DataTable();
               foreach (XmlNode node in xmlNodeList.Item(0).ChildNodes) 
               {
                   DataColumn dc = new DataColumn(node.FirstChild.InnerText, System.Type.GetType("System.String"));
                   dt.Columns.Add(dc);
               }
    
               int ColumnsCount = dt.Columns.Count;
    
               string[] columnNames = dt.Columns.Cast<DataColumn>().
                                                 Select(column => column.ColumnName).
                                                 ToArray();
               sb.AppendLine(string.Join(separator, columnNames));
    
               string[] rows = new string[ColumnsCount];
    
               for (int i = 1; i < xmlNodeList.Count; i++) // loop through rows
               {
                   for (int j = 0; j < ColumnsCount; j++) // loop through columns
                   {
    
                       rows[j] = xmlNodeList.Item(i).ChildNodes[j].InnerText.Replace(separator, ",").Replace("\r\n", " ").Replace("\n", " ").Replace("\r", " "); // remove seperator from original text, it will casue problem 
    
                   }
                   sb.AppendLine(string.Join(separator, rows));
                   Array.Clear(rows, 0, ColumnsCount);
               }
    
               return sb;
           }
           catch (Exception)
           {
    
               throw;
           }
       }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We currently have a process where we receive an inventory file from a vendor
I have a simple question about sending a file (XML file) from my webapp
I have created JAVA GUI that will receive text file(.txt) from other client and
I have a program that roughly does this: open a file to read from
I have recently used an icon file received from our marketing team. The icon
I have received a CSV that has been converted/compressed/compacted into a SAV file from
I have a file with DOS line endings that I receive at run-time, so
I am developing a system that will receive a XML (XmlDocument) via webservice. I
I have a receive callback from an async client method that is supposed to
I have some web-form which posts some data and user file to first php

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.