5

I want to make a excel file where the data is collected and updated automatically off my site and display as data tables.

I have tried to web import off the site from a table I have created but it is not formatted as a data table.

I have also created a xml file and used a .iqy file to get the data and still it is not imported as a data table

This is my .iqy file which will import data but not as a xml

WEB
1
http://localhost:55369/files/SerializationOverview.xml

This is my test xml file

  <?xml version="1.0"?>
    <bookstore>
      <book category="COOKING">
        <title lang="en">Everyday Italian</title>
        <author>Giada De Laurentiis</author>
        <year>2005</year>
        <price>30.00</price>
      </book>
      <book category="CHILDREN">
        <title lang="en">Harry Potter</title>
        <author>J K. Rowling</author>
        <year>2005</year>
        <price>29.99</price>
      </book>
      <book category="WEB">
        <title lang="en">Learning XML</title>
        <author>Erik T. Ray</author>
        <year>2003</year>
        <price>39.95</price>
      </book>
    </bookstore>

Thank you in advance any help is much appreciated.

chris castle
  • 173
  • 2
  • 10

1 Answers1

0

Read the third/last line of your .iqy file:

var url = File.ReadLines(@"query.iqy").Take(3).Last();

Then download the xml like using:

using (var wc = new System.Net.WebClient())
{
   contents = wc.DownloadString(url);
}

And then parse the xml using XDocument.Parse(contents), go through the xml and write the data to the database.

Leo
  • 5,013
  • 1
  • 28
  • 65