Search code examples
pythonpandasgoogle-sheetsgspread

Apending values in google sheets add ' with the values using gspread


I am following this tutorial to append new rows to my existing dataset which is working fine except one thing that is that the code is adding ' at the start of values like this

enter image description here

enter image description here

Last two rows are the problem. I have tried converting them to string but it still shows the same output

try:
    merge_values = merge.values.tolist()
    gs.values_append('Merged', {'valueInputOption': 'RAW'}, {'values': merge_values})
except: 
    print('No new data')

Solution

  • You will need to change the valueInputOption to USER_ENTERED as this will input the data as if you typed it into the Google Sheet.

    try:
        merge_values = merge.values.tolist()
        gs.values_append('Merged', {'valueInputOption': 'USER_ENTERED'}, {'values': merge_values})
    except: 
        print('No new data')