Convert xml to csv

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Connull

    Convert xml to csv

    I have extracted data from a SQL database and need to convert it to a csv. I
    have transformed the data to xml and then save it with .xls extension which
    is viewable in Excel. As soon as I try save the xml to a csv, I view all the
    tags when I open the document in Excel.

    Please could some one assist with a possible better solution.

    Thanks in advance
  • James Mahoney

    #2
    RE: Convert xml to csv

    > I have extracted data from a SQL database and need to convert it to a csv. I[color=blue]
    > have transformed the data to xml and then save it with .xls extension which
    > is viewable in Excel. As soon as I try save the xml to a csv, I view all the
    > tags when I open the document in Excel.
    >[/color]

    One simple way is to use a style sheet to transform the XML into CSV using
    XslTransform.

    I'm sure Excel has got some import options to import XML and turn it into a
    proper spreadsheet though

    James

    Comment

    • James Mahoney

      #3
      RE: Convert xml to csv

      > I have extracted data from a SQL database and need to convert it to a csv. I[color=blue]
      > have transformed the data to xml and then save it with .xls extension which
      > is viewable in Excel. As soon as I try save the xml to a csv, I view all the
      > tags when I open the document in Excel.
      >[/color]

      One simple way is to use a style sheet to transform the XML into CSV using
      XslTransform.

      I'm sure Excel has got some import options to import XML and turn it into a
      proper spreadsheet though

      James

      Comment

      • Connull

        #4
        RE: Convert xml to csv



        "James Mahoney" wrote:
        [color=blue][color=green]
        > > I have extracted data from a SQL database and need to convert it to a csv. I
        > > have transformed the data to xml and then save it with .xls extension which
        > > is viewable in Excel. As soon as I try save the xml to a csv, I view all the
        > > tags when I open the document in Excel.
        > >[/color]
        >
        > One simple way is to use a style sheet to transform the XML into CSV using
        > XslTransform.
        >
        > I'm sure Excel has got some import options to import XML and turn it into a
        > proper spreadsheet though
        >
        > James[/color]

        If I may so be so bold as to where I might obtain sample code for this. I
        have looked through my MSDN but have not been fruitfull

        Connull

        Comment

        • Connull

          #5
          RE: Convert xml to csv



          "James Mahoney" wrote:
          [color=blue][color=green]
          > > I have extracted data from a SQL database and need to convert it to a csv. I
          > > have transformed the data to xml and then save it with .xls extension which
          > > is viewable in Excel. As soon as I try save the xml to a csv, I view all the
          > > tags when I open the document in Excel.
          > >[/color]
          >
          > One simple way is to use a style sheet to transform the XML into CSV using
          > XslTransform.
          >
          > I'm sure Excel has got some import options to import XML and turn it into a
          > proper spreadsheet though
          >
          > James[/color]

          If I may so be so bold as to where I might obtain sample code for this. I
          have looked through my MSDN but have not been fruitfull

          Connull

          Comment

          • James Mahoney

            #6
            RE: Convert xml to csv

            [color=blue][color=green]
            > > One simple way is to use a style sheet to transform the XML into CSV using
            > > XslTransform.
            > >
            > > I'm sure Excel has got some import options to import XML and turn it into a
            > > proper spreadsheet though
            > >
            > > James[/color]
            >
            > If I may so be so bold as to where I might obtain sample code for this. I
            > have looked through my MSDN but have not been fruitfull
            >[/color]

            For info on XslTransform just search MSDN for XslTransform :-)

            To write the style sheet itself you'll need to get to grips with XSLT. This
            site is always useful for XML pointers http://www.w3schools.com/xsl/

            I've got a style sheet kicking about in work somewhere that I can dig out if
            you want - might be useful as an example
            James



            Comment

            • James Mahoney

              #7
              RE: Convert xml to csv

              [color=blue][color=green]
              > > One simple way is to use a style sheet to transform the XML into CSV using
              > > XslTransform.
              > >
              > > I'm sure Excel has got some import options to import XML and turn it into a
              > > proper spreadsheet though
              > >
              > > James[/color]
              >
              > If I may so be so bold as to where I might obtain sample code for this. I
              > have looked through my MSDN but have not been fruitfull
              >[/color]

              For info on XslTransform just search MSDN for XslTransform :-)

              To write the style sheet itself you'll need to get to grips with XSLT. This
              site is always useful for XML pointers http://www.w3schools.com/xsl/

              I've got a style sheet kicking about in work somewhere that I can dig out if
              you want - might be useful as an example
              James



              Comment

              • Connull

                #8
                RE: Convert xml to csv



                "James Mahoney" wrote:
                [color=blue]
                >[color=green][color=darkred]
                > > > One simple way is to use a style sheet to transform the XML into CSV using
                > > > XslTransform.
                > > >
                > > > I'm sure Excel has got some import options to import XML and turn it into a
                > > > proper spreadsheet though
                > > >
                > > > James[/color]
                > >
                > > If I may so be so bold as to where I might obtain sample code for this. I
                > > have looked through my MSDN but have not been fruitfull
                > >[/color]
                >
                > For info on XslTransform just search MSDN for XslTransform :-)
                >
                > To write the style sheet itself you'll need to get to grips with XSLT. This
                > site is always useful for XML pointers http://www.w3schools.com/xsl/
                >
                > I've got a style sheet kicking about in work somewhere that I can dig out if
                > you want - might be useful as an example
                > James
                >
                > It would be appreciated. By the way, my xml document is viewable in Excel and I can also save the xml doc as xls. I unfortunately need the CSV as I need it in this format to import the data into another program. I thought there might be an easy way to use Excel's SaveAs option.[/color]
                Connull[color=blue]
                >[/color]

                Comment

                • Connull

                  #9
                  RE: Convert xml to csv



                  "James Mahoney" wrote:
                  [color=blue]
                  >[color=green][color=darkred]
                  > > > One simple way is to use a style sheet to transform the XML into CSV using
                  > > > XslTransform.
                  > > >
                  > > > I'm sure Excel has got some import options to import XML and turn it into a
                  > > > proper spreadsheet though
                  > > >
                  > > > James[/color]
                  > >
                  > > If I may so be so bold as to where I might obtain sample code for this. I
                  > > have looked through my MSDN but have not been fruitfull
                  > >[/color]
                  >
                  > For info on XslTransform just search MSDN for XslTransform :-)
                  >
                  > To write the style sheet itself you'll need to get to grips with XSLT. This
                  > site is always useful for XML pointers http://www.w3schools.com/xsl/
                  >
                  > I've got a style sheet kicking about in work somewhere that I can dig out if
                  > you want - might be useful as an example
                  > James
                  >
                  > It would be appreciated. By the way, my xml document is viewable in Excel and I can also save the xml doc as xls. I unfortunately need the CSV as I need it in this format to import the data into another program. I thought there might be an easy way to use Excel's SaveAs option.[/color]
                  Connull[color=blue]
                  >[/color]

                  Comment

                  • James Mahoney

                    #10
                    RE: Convert xml to csv

                    I'm sure excel must have an import from XML option that will grab your XML
                    and add it to a work sheet. From there save as CSV should work.
                    Getting back to the XSL - my stylesheet would probably do more harm than
                    good. How are you getting your data out of the database - just as a dataset?

                    James

                    "Connull" wrote:
                    [color=blue]
                    >
                    >
                    > "James Mahoney" wrote:
                    >[color=green]
                    > >[color=darkred]
                    > > > > One simple way is to use a style sheet to transform the XML into CSV using
                    > > > > XslTransform.
                    > > > >
                    > > > > I'm sure Excel has got some import options to import XML and turn it into a
                    > > > > proper spreadsheet though
                    > > > >
                    > > > > James
                    > > >
                    > > > If I may so be so bold as to where I might obtain sample code for this. I
                    > > > have looked through my MSDN but have not been fruitfull
                    > > >[/color]
                    > >
                    > > For info on XslTransform just search MSDN for XslTransform :-)
                    > >
                    > > To write the style sheet itself you'll need to get to grips with XSLT. This
                    > > site is always useful for XML pointers http://www.w3schools.com/xsl/
                    > >
                    > > I've got a style sheet kicking about in work somewhere that I can dig out if
                    > > you want - might be useful as an example
                    > > James
                    > >
                    > > It would be appreciated. By the way, my xml document is viewable in Excel and I can also save the xml doc as xls. I unfortunately need the CSV as I need it in this format to import the data into another program. I thought there might be an easy way to use Excel's SaveAs option.[/color]
                    > Connull[color=green]
                    > >[/color][/color]

                    Comment

                    Working...