我对gheets是个新手,正在寻找一种方法,将我搜集到的数据插入到当前python字典中的gheets中。我想在批处理过程中这样做,这样我的蜘蛛可以一次更新多个字段。你知道吗
{'page_url': 'https://www.websiteurl.com', 'company': 'my company', 'location': 'The Netherlands',
'price_excl_vat': '30000'}
我试图构建一个json请求,但得到TypeError:unhable type:'dict'。我知道这是因为数据字段需要一个字符串,但是我想我可以用一个字典,而且似乎找不到怎么做。一整天都在这样,似乎不知道我做错了什么。你知道吗
batch_update_spreadsheet_request_body = {
{
"requests": [
{
"insertRange": {
"range": {
"sheetId": '12345tutu',
},
}
},
{
"pasteData": {
"data": {'page_url': 'https://www.websiteurl.com', 'company': 'my company', 'location': 'The Netherlands',
'price_excl_vat': '30000'},
}
}
]
}
}
request = service.spreadsheets().batchUpdate(spreadsheetId=spreadsheet_id, body=batch_update_spreadsheet_request_body)
response = request.execute()
您应该删除一对
{}
:它创建了一个包含dictionary的集合,这是不可能的,因为正如错误所说,set元素必须是可哈希的,而dict则不是。你知道吗
相关问题 更多 >
编程相关推荐