0

As the question states, openpyxl reads files like I need it to but I don't know how to download the file from a sharepoint site and read it using openpyxl.

The url is something like this http://teamsites.teamworks.net/sites/efit-eitecs-005/SiteAssets/Lists/Apr19/AllItems/Gluster-2019.15-OS.xlsm

I'm currently using the following code.

import requests
import urllib

resp = requests.get(a, auth=auth).content

output = open(r'C:\Users\Me\temp.xlsx', 'wb')
output.write(resp)
output.close()

Anyone know the answer? Should I be saving as an xlsm file instead? I don't know what to do.

Ravaal
  • 3,233
  • 6
  • 39
  • 66
  • This sounds like 2 separate and unrelated questions to me. Maybe if you include what code you've tried it would make more sense how they are related? – Reedinationer May 21 '19 at 18:47
  • I've updated the question – Ravaal May 21 '19 at 18:53
  • What's the issue? It looks like you're writing rather than reading. Are you hitting an exception? – C.Nivs May 21 '19 at 19:06
  • There's no exception. I'm downloading the file from a sharepoint site and when I try to read it there is no data because the file only contains a template. – Ravaal May 21 '19 at 19:13
  • 1
    The link doesn't seem to work, so I don't know how I would go about verifying code I post for an answer. If you want input on the method, why not download the file to disk and then open it from there. This way you can break the problem into 2 sub-problems and diagnose each individually. – Reedinationer May 21 '19 at 19:18
  • Possible duplicate of [How do I download an xlsm file and read every sheet in python?](https://stackoverflow.com/questions/56226066/how-do-i-download-an-xlsm-file-and-read-every-sheet-in-python) – Matt M May 21 '19 at 19:18
  • openpyxl requires local file system access for reading and writing files. – Charlie Clark May 22 '19 at 08:51

0 Answers0