groshanr's picture
Upload folder using huggingface_hub
48cb310 verified
import sys
import subprocess
import os
import keyfiledict
import gspread
from oauth2client.service_account import ServiceAccountCredentials
from google.oauth2 import service_account
from dotenv import load_dotenv
load_dotenv()
# Upgrade pip
subprocess.check_call([sys.executable, "-m", "pip", "install", "--upgrade", "pip"])
# Check if the venv module is available
if sys.version_info >= (3, 3):
subprocess.run([sys.executable, "-m", "venv", "venv"])
else:
subprocess.run(["python", "-m", "venv", "venv"])
# Activate the virtual environment
activate_script = os.path.join("venv", "Scripts", "activate")
subprocess.run(activate_script, shell=True)
subprocess.check_call(["pip", "install", "google-api-python-client"])
# Install oauth2client
subprocess.check_call(["pip", "install", "oauth2client"])
subprocess.check_call(["pip", "install", "gspread"])
# credentials file downloaded from Google Developers Console
client = gspread.authorize(keyfiledict.credentials())
sheet = client.open('Zapotec Minimal Pairs').sheet1
# Get all values from the sheet
list_of_data = sheet.get_all_records()
# Get a range of cells
cells = sheet.range('C2:C32')
for cell in cells:
print(cell.value)
#print(list_of_data)