Hi I am running a Google APi script to enter data into a sheet but for some text (number,dates, booleans) it's adding a ' before e.g 05/01/2021 = '05/01/2021
I am using batch update:
def turn_into_range(data, SheetId, row,cols):
rows = [{'values': [{'userEnteredValue': {'stringValue': f}} for f in e]} for e in data]
rng = {'sheetId': SheetId, 'startRowIndex': 0, 'startColumnIndex': 0}
fields = 'userEnteredValue'
body = {'requests': [{'updateCells': {'rows': rows, 'range': rng, 'fields': fields}},{
"updateSheetProperties": {
"properties": {
"gridProperties": {
"rowCount": row + 1,
"columnCount": cols
},
"sheetId": SheetId
},
"fields": "gridProperties"
},
}
]}
clean_dict = simplejson.loads(simplejson.dumps(body, ignore_nan=True))
return clean_dict
def post_sheet(service_sheets, spreadsheet_id, body):
request = service_sheets.spreadsheets().batchUpdate(spreadsheetId=spreadsheet_id, body=body)
response = request.execute()
return response
any ideas?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…