0

New to python...I have some code setup to export some output to a google sheet. The command I am using for that is

row = [timestamp,float(temperature),float(humidity),current_temperature,current_humidity,current_pressure,weather_description]
sheet.insert_row(row, index)

The issue is that the timestamp variable is adding a single quote in front of itself when it is inserted into the sheet, but when using print(timestamp), this quote is not there.:

enter image description here

This makes it difficult because I cannot make any graphs with that quote in front of the output. The commands I am using for time are as follows:

    now = datetime.now()
    timestamp = now.strftime("%m/%d/%Y%l:%M:%S %p")

How can I get a timestamp without a single quote in front?

Aaron
  • 3,135
  • 20
  • 51
  • 78
  • 1
    The tick is coming from google sheets to indicate it is a string, not a date/time field. – Mark Tolonen Jun 02 '20 at 06:28
  • this isn't python, but it might help: [Google Sheet API V4(Java) append Date in cells](https://stackoverflow.com/questions/37986171/google-sheet-api-v4java-append-date-in-cells/37993497#37993497) – bug_spray Jun 02 '20 at 06:32
  • @MarkTolonen is there any way to change the timestamp variable to something else so sheets doesnt do that? – Aaron Jun 02 '20 at 08:41
  • I don’t know the specific commands for Google sheets, but Excel uses a floating point value for number of days since the epoch and cell formatting to display it as a date. – Mark Tolonen Jun 02 '20 at 15:04

0 Answers0