python - 如何将数据抓取与谷歌表格连接起来
问题描述
我有这个来自网络抓取的代码
from smart_sensor_client.smart_sensor_client import SmartSensorClient
import json
import requests
import pprint
DEFAULT_SETTINGS_FILE = 'settings.yaml'
def run_task(settings_file=DEFAULT_SETTINGS_FILE) -> bool:
# Create the client instance
client = SmartSensorClient(settings_file=settings_file)
# Authenticate
if not client.authenticate():
print('Authentication FAILED')
return False
# Get list of plants
plants = client.get_plant_list()
# Iterate the plant list and print all assets therein
for plant in plants:
# Get list of assets
response = client.get_asset_list(organization_id=client.organization_id)
if len(response) == 0:
print('No assets in this plant')
else:
for asset in response:
print(asset["assetName"],':',asset["lastSyncTimeStamp"])
...
以及下面的答案。我用我感兴趣的信息过滤的json。
Ventilador FCH 11 : 2020-06-11T09:48:45Z
VTL SVA1 : 2020-06-11T10:20:43Z
Dardelet PV-1 : 2020-06-11T09:58:14Z
CANDLOT 1 (MOTOR N°2) : 2020-06-11T10:37:39Z
PC N°1 S1/2A : 2020-06-11T10:57:34Z
VTL SVA2 : 2020-06-11T11:31:08Z
Ventilador FCH 6 : 2020-06-11T11:43:28Z
Vibrotamiz Tolva Tampon : 2020-06-11T11:44:43Z
Ventilador FCH 10 : 2020-06-11T11:08:03Z
Task SUCCESS
我想把它粘贴到谷歌表上,但我不知道它是否可能。谢谢!
解决方案
推荐阅读
- uwp - UWP Pivot,确定点击了哪个PivotItem
- flutter - 在中间页面中使用 PushReplacement 时无法弹出值
- javascript - 如何在 React 中使用来自 JSON 的地图在 div 中设置背景图像
- laravel - 无法在 Laravel Blade 视图中检索会话
- python - Spark使用Boto3提交Scala jar
- python - 如何通过同时和顺序运行来加速 python 脚本
- java - "message": "从类型 [java.lang.String] 转换为类型 [java.lang.Long] 的值 'count' 失败;对于输入字符串:\"count\""
- python - 如何在 python-vlc 中禁用多个实例?
- angular - 在使用 CLI 和 Sass 的 Angular 项目中,如何查看已编译的组件 CSS?
- azure - 在主题分支中创建了 Azure 管道 yaml 文件,我可以从主题分支运行它吗?