0
gc = pygsheets.authorize(service_file='https://api.myjson.com/bins/******')

I tried this now, but I'm getting this error:

FileNotFoundError: [Errno 2] No such file or directory: 'https://api.myjson.com/bins/******'

How can I do this?

Slip
  • 1
  • 2

1 Answers1

0

Currenlty pygsheets expects the service_file to be a file. So You will need to first download the remote file and then use it in pygsheets.

import requests 
import pygsheets
image_url = "https://api.myjson.com/bins/******"
r = requests.get(image_url)
with open("service.json",'wb') as f: 
    f.write(r.content)

gc = pygsheets.authorize(service_file='service.json')
Nithin
  • 5,470
  • 37
  • 44