CoolFace
Apppublic

disenosla2pc/generador-l2pc

sourceHugging Facemitupdated 3d agoView on Hugging Face
0likes
update_headers.py29 linesDownload Raw Back to root
1import gspread2from oauth2client.service_account import ServiceAccountCredentials3 4CREDENTIALS_FILE = "config/credentials.json"5SPREADSHEET_ID = "1E04DImzdqavAyIvKZ-oUcMViZtzmy3nw2V3S2FcUIbg"6HOJA = "Promociones_Globales"7 8def update_headers():9    scope = ['https://spreadsheets.google.com/feeds', 'https://www.googleapis.com/auth/drive']10    creds = ServiceAccountCredentials.from_json_keyfile_name(CREDENTIALS_FILE, scope)11    client = gspread.authorize(creds)12    13    sheet = client.open_by_key(SPREADSHEET_ID)14    ws = sheet.worksheet(HOJA)15    16    headers = ws.row_values(1)17    print("Current headers:", headers)18    19    if "Imagen_Fondo_PC" not in headers:20        print("Adding missing headers...")21        new_headers = headers + ["Imagen_Fondo_PC", "Imagen_Fondo_Mobile"]22        ws.update('A1:J1', [new_headers])23        print("Updated headers to:", new_headers)24    else:25        print("Headers already exist!")26 27if __name__ == "__main__":28    update_headers()29