Group Abstract Group Abstract

Message Boards Message Boards

How to import an XML file otherwise intended for Microsoft Excel?

Posted 11 years ago
POSTED BY: Stephen Wilkus
2 Replies

Hi ,

I did a test with this code :

StringSplit[StringReplace[
  xml, "<" ~~ Except[">"] .. ~~ ">" -> ""], "\n"]

where , xml =

"<?xml version=\"1.0\"?>
<ss:Workbook xmlns:ss=\"urn:schemas-microsoft-com:office:spreadsheet\">
    <ss:Worksheet ss:Name=\"Sheet1\">
        <ss:Table>
            <ss:Column ss:Width=\"80\"/>
            <ss:Column ss:Width=\"80\"/>
            <ss:Column ss:Width=\"80\"/>
            <ss:Row>
                <ss:Cell>
                   <ss:Data ss:Type=\"String\">First Name</ss:Data>
                </ss:Cell>
                <ss:Cell>
                   <ss:Data ss:Type=\"String\">Last Name</ss:Data>
                </ss:Cell>
                <ss:Cell>
                   <ss:Data ss:Type=\"String\">Phone Number</ss:Data>
                </ss:Cell>
            </ss:Row>
            <ss:Row>
                <ss:Cell>
                   <ss:Data ss:Type=\"String\">Nancy</ss:Data>
                </ss:Cell>
                <ss:Cell>
                   <ss:Data ss:Type=\"String\">Davolio</ss:Data>
                </ss:Cell>
                <ss:Cell>
                   <ss:Data ss:Type=\"String\">(206)555 9857</ss:Data>
                </ss:Cell>
            </ss:Row>
        </ss:Table>
    </ss:Worksheet>

</ss:Workbook>"

And the result is:

{"    ", "        ", "            ", "            ", "            ", \
"            ", "                ", "                   First Name", \
"                ", "                ", "                   Last \
Name", "                ", "                ", "                   \
Phone Number", "                ", "            ", "            ", "  \
              ", "                   Nancy", "                ", "    \
            ", "                   Davolio", "                ", "    \
            ", "                   (206)555 9857", "                \
", "            ", "        ", "    "}

After that , you just need to clean the list easily.

POSTED BY: Marcelo De Cicco
Posted 11 years ago
POSTED BY: Gustavo Delfino
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard