I am trying to download a file of type OSHEET from Synology FileStation as an XLSX file using python and the SYNO.FileStation.Download API.
Here is my current attempt:
response = requests.get(myURL+
"/webapi/entry.cgi/?api=SYNO.FileStation.Download&version=2&method=download&path="
+ pathToFile + "&mode=download&_sid="+sid, allow_redirects=True)
output = open('test.xlsx', 'wb')
output.write(response.content)
output.close()
When I execute this request in my python script the file test.xlsx is created but I can't open it - I get an error saying: Excel cannot open the file 'test.xlsx' because the file format or file extension is not valid.
I know that the file type OSHEET from Synology NAS can be converted to an XLSX file because I have done this through the web UI for Synology NAS. Is there a way the I can convert the response object returned from the FileStation API call into an XLSX file using python?