Graph API convert to other formats xlsx reporting "Incorrect format specified"

Steven Fayers 1 Reputation point
2021-02-06T11:27:49.917+00:00

Using graph API, I have a CSV file stored on SharePoint, and I'm trying to convert the content to xlsx following this page:
https://learn.microsoft.com/en-us/graph/api/driveitem-get-content-format?view=graph-rest-1.0&tabs=http

using

GET           https://graph.microsoft.com/v1.0/drives/(driveid)/items/(itemid)/content   

I get the content returned, but using

GET           https://graph.microsoft.com/v1.0/drives/(driveid)/items/(itemid)/content?format=xlsx   

I get an error:

"code": "invalidRequest",  
"message": "Incorrect format specified"  

I tried PDF as well:

GET           https://graph.microsoft.com/v1.0/drives/(driveid)/items/(itemid)/content?format=pdf  

I get a different type of error,

 "code": "notSupported",  
  "message": "csv",  
  "innererror": {  
    "code": "InputFormatNotSupported"  

Can anybody advise me if the graph API can convert CSV to XLSX, and if so, what is wrong with my request?

Microsoft Security | Microsoft Graph
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.