Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Jump to next empty column with Google Sheets & Python
#1
I have a series of python scripts that enter data into a Google sheets column. I want to jump over to the next empty column if I run everything the next day. Here's a simple version of what I've got - it just puts today's date into cell A1.

import gspread
from oauth2client.service_account import ServiceAccountCredentials

scope = ['https://spreadsheets.google.com/feeds', 'https://www.googleapis.com/auth/drive']
creds = ServiceAccountCredentials.from_json_keyfile_name('client_penny.json', scope)
client = gspread.authorize(creds)

from datetime import datetime

date = datetime.today().strftime('%Y-%m-%d')

penny = client.open('pennystocks').worksheet('DGTW')

penny.update_acell('A1', date)
I want the date to go into B1 if I run it tomorrow (or whatever the next available column is if I've already run it a few times).

I found these related examples, but I think they're for javascript. (I'm a noon at this)

https://webapps.stackexchange.com/questi...ati/101200

https://webapps.stackexchange.com/questi...fic-column
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  How to fix and extract Google CSE JSON API using Python.exe venkatsrrecruiter 1 159 May-04-2019, 07:33 PM
Last Post: venkatsrrecruiter
  Project: “I’m Feeling Lucky” Google Search Truman 29 4,904 Apr-30-2019, 06:42 PM
Last Post: nilamo
  Interfacing Google Chrome & Python akornrumpf 5 352 Mar-16-2019, 10:20 PM
Last Post: Larz60+
  RESTful API in Google Cloud Functions fggmack 0 272 Dec-30-2018, 06:58 AM
Last Post: fggmack
  Web application with google maps api jomonetta 1 511 Sep-13-2018, 05:23 AM
Last Post: buran
  ImportError: No module named django.core.exceptions in google app engine timtinan37 4 1,200 Jun-18-2018, 01:34 PM
Last Post: Larz60+
  Cant get financial data from google Adam 0 1,104 Apr-11-2018, 03:02 PM
Last Post: Adam
  How to use BeautifulSoup to parse google search results DevinGP 16 7,433 Dec-22-2017, 10:23 PM
Last Post: snippsat
  xpath returns an empty list haye 5 2,491 Nov-24-2017, 09:53 AM
Last Post: heiner55
  Display google recpatcha at the end of the form django-allauth app prithvi 2 1,237 Aug-08-2017, 09:19 PM
Last Post: prithvi

Forum Jump:


Users browsing this thread: 1 Guest(s)