Google Sheets F# Access and XML

253 Views Asked by At

I would like to load the contents of some spreadsheet into an XmlDocument. What I got is:

let req = WebRequest.Create "http://spreadsheets.google.com/ccc?key=pXMFQ3e4aFY11oQkT_7FhZg"
let resp = req.GetResponse ()
let stream = resp.GetResponseStream ()
let xdoc = new XmlDocument()
xdoc.Load stream

I get the following error:

System.Xml.XmlException: An error occurred while parsing EntityName. Line 12, position 22057.
  at System.Xml.XmlTextReaderImpl.Throw(Exception e)
  at System.Xml.XmlTextReaderImpl.ParseEntityName()
  at System.Xml.XmlTextReaderImpl.ParseEntityReference()
  at System.Xml.XmlTextReaderImpl.Read()
  at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)
  at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
  at System.Xml.XmlDocument.Load(XmlReader reader)
  at System.Xml.XmlDocument.Load(Stream inStream)
  at <StartupCode$FSI_0008>.$FSI_0008.main@()
Stopped due to error

Replacing that spreadsheet with the simplest one with only a column of few integers does not change anything.

Does it have something to do specifically with "Google Sheets" and if so, what should I do prior to loading or do I have to go down a different route?

0

There are 0 best solutions below