title: Loading an xlsx or csv file from Sharepoint into Spotfire using IronPython script
body: <p>if I try to load the data using below script, the html code is being loaded instead of proper data. The given link leads to the direct source of xlsx or csv file (if you run that link in the browser, the xlsx or csv file will start downloading automatically). I would be glad to hear why this kind of situation happens and how to love this problem.</p>
  
  <pre><code>import clr
  clr.AddReference('System.Net')
  from System.Net import HttpWebRequest, NetworkCredential
  from Spotfire.Dxp.Data.Import import TextFileDataSource, TextDataReaderSettings
  
  readerSettings = TextDataReaderSettings()
  readerSettings.Separator = ";"
  readerSettings.CultureName = "en-GB"
  
  req = HttpWebRequest.Create("some link to xlsx file")
  
  user_agent = 'individual user-agent'
  req.UserAgent = user_agent
  req.Method = "GET"
  
  req.UseDefaultCredentials = True
  #req.PreAuthenticate = True
  user = Document.Properties["Username"]
  password = Document.Properties["Password"]
  
  req.Credentials = NetworkCredential(user, password)
  
  rsp = req.GetResponse()
  dSource = TextFileDataSource(rsp.GetResponseStream(),readerSettings)
  rsp.Close()
  
  dataManager = Document.Data
  dataTable = dataManager.Tables[document.Name]
  dataTable.ReplaceData(dSource)
  </code></pre>