Quantcast
Channel: Windows PowerShell Forum
Viewing all articles
Browse latest Browse all 2562

Understanding/processing a string returned in Powershell from the Excel Services RESTful API?

$
0
0

I'm using Invoke-Method to retrieve a named range from an Excel file on Sharepoint like such,

$data = Invoke-RESTmethod -uri "<serverName>/_vti_bin/ExcelRest.aspx/<docLocation>/<docName.xlsx>/model/ranges('<rangeName>')" -cred <myCredentials>

But, no matter what cmdlet, or how I pipe the $data variable, I have not gotten anything very usable. I get the below details when I request the same with '?$=format=atom',

<?xml version="1.0" encoding="utf-8"?><entry xmlns:x="http://schemas.microsoft.com/office/2008/07/excelservices/rest" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservice" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom"><title type="text">A1:R1</title><id>https://<serverName>/_vti_bin/ExcelRest.aspx/sites/<docLocation>/<docName>.xlsx/model/ranges('A1%7CR1')</id><updated>2013-02-14T15:34:23Z</updated><author><name /></author><link rel="self" href="https://<serverName>/_vti_bin/ExcelRest.aspx/sites/<docLocation>/<docName>.xlsx/model/ranges('A1%7CR1')?$format=atom" title="A1:R1" /><category term="ExcelServices.Range" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><content type="application/xml"><x:range name="A1:R1"><x:row><x:c><x:fv>Incident ID</x:fv></x:c><x:c><x:fv>Assignment Group</x:fv></x:c><x:c><x:fv>Assignee</x:fv></x:c><x:c><x:fv>Opened At</x:fv></x:c>

</x:row></x:range></content></entry>

So I figure I should just be able to pipe the initial $data to,

Select-object -expandProperty 'range'

But that gets me an error message that 'range', or what ever else I put in is not found. And if I run,

Select-Object *

All I get is a 'length' property.

Could someone suggest to me a place to read up on what I am missing, or not understanding about what exactly the Excel API is returning? I was expecting an object that Powershell would see as a table, not a log string of tag data.


Viewing all articles
Browse latest Browse all 2562

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>