I have been using the excellent GSpread for some time now to append data to a Google Sheet. However, now that a large amount of data has been collected it has become unwieldy to use from within Google apps; to access the last data that is appended can sometimes take minutes as the app loads the entire data set.
What I would like to do is insert the data into the beginning of the sheet, i.e. so that the most recent data is presented first rather than last. Although there is an "insert row" function in GSpread, I am unsure how to then use this to input multiple items of columnar data.
The relevant portion of my Python script is as follows:
Code: Select all
..
..
import gspread
..
..
worksheet = gc.open(spreadsheet).sheet1
..
..
# Append the data in the spreadsheet, including a timestamp
try:
values = [datetime.datetime.now(), tempa, humiditya, rasp[5:9], sig, uptiming, loading]
valtim = datetime.datetime.now().strftime("%H-%M")
worksheet.append_row(values)
disptime = [datetime.datetime.now()]
except:
print "Unable to append data. Check your connection?"
#sys.exit()
Can anyone offer advice?
Thank you