해결하고자 하는 문제
코랩에서 파일을 불러올 때 csv, xlsx는 되는데
구글 스프레드시트(확장자 gsheet) 파일을 불러오는 방법을 모르겠습니다.
코드 혹은 오류
StopIteration Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/gspread/client.py in open(self, title)
121 lambda x: x['name'] == title,
--> 122 self.list_spreadsheet_files()
123 )
2 frames
StopIteration:
During handling of the above exception, another exception occurred:
SpreadsheetNotFound Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/gspread/client.py in open(self, title)
128 return Spreadsheet(self, properties)
129 except StopIteration:
--> 130 raise SpreadsheetNotFound
131
132 def open_by_key(self, key):
SpreadsheetNotFound:
환경
윈도우 10 노트북에서 크롬 브라우저를 통해 코랩에 접속해서 작업
시도해본 방법
검색을 해보니 아래 링크와 같은 내용이 있어서 그대로 따라 했습니다.(더 마땅한 내용을 못찾았습니다.)
https://colab.research.google.com/notebooks/io.ipynb#scrollTo=sOm9PFrT8mGG
위 링크의 내용을 따라 하면서 새 시트명까지 "My cool spreadsheet"로 만들고
제가 엑셀에 가지고 있던 데이터를 붙여넣기 하고,
링크에 있는 것 처럼 "My cool spreadsheet"파일을 불러오면 정상적으로 불러옵니다.
그런데,
worksheet = gc.open('My cool spreadsheet').sheet1 에서 파일명 대신
1번: /content/drive/MyDrive/Colab Notebooks/mydata/hantaro_60x14.gsheet
2번: https://drive.google.com/drive/folders/1Ob3VDeCWTDrd45pOG2nXfnd51vvNIXR6/hantaro_60x14.gsheet
두 가지 경로를 입력하면 오류메시지(1번에 대한 오류)가 뜸니다.
권한 인증 등의 문제는 없는 것 같은데, 제 구글 드라이브 하위 폴더에 있는 스프레드시트 파일을
불러올 수 있는 방법 알려주시면 감사하겠습니다.
해결하고자 하는 문제
코랩에서 파일을 불러올 때 csv, xlsx는 되는데
구글 스프레드시트(확장자 gsheet) 파일을 불러오는 방법을 모르겠습니다.
코드 혹은 오류
환경
윈도우 10 노트북에서 크롬 브라우저를 통해 코랩에 접속해서 작업
시도해본 방법
검색을 해보니 아래 링크와 같은 내용이 있어서 그대로 따라 했습니다.(더 마땅한 내용을 못찾았습니다.)
https://colab.research.google.com/notebooks/io.ipynb#scrollTo=sOm9PFrT8mGG
위 링크의 내용을 따라 하면서 새 시트명까지 "My cool spreadsheet"로 만들고
제가 엑셀에 가지고 있던 데이터를 붙여넣기 하고,
링크에 있는 것 처럼 "My cool spreadsheet"파일을 불러오면 정상적으로 불러옵니다.
그런데,
worksheet = gc.open('My cool spreadsheet').sheet1 에서 파일명 대신
1번: /content/drive/MyDrive/Colab Notebooks/mydata/hantaro_60x14.gsheet
2번: https://drive.google.com/drive/folders/1Ob3VDeCWTDrd45pOG2nXfnd51vvNIXR6/hantaro_60x14.gsheet
두 가지 경로를 입력하면 오류메시지(1번에 대한 오류)가 뜸니다.
권한 인증 등의 문제는 없는 것 같은데, 제 구글 드라이브 하위 폴더에 있는 스프레드시트 파일을
불러올 수 있는 방법 알려주시면 감사하겠습니다.