将csv文件导出到google电子表格
csv-export-gsheets的Python项目详细描述
安装
pip
您可以安装运行此命令的最新稳定包:
$ pip install csv_export_gsheets
也可以安装运行此命令的开发版本:
$ pip install git+http://github.com/dlancer/csv_export_gsheets.git@dev
用法
开始之前,您应该:
创建google服务帐户密钥(使用json格式):
在google电子表格中创建新的电子表格。
将此电子表格与来自已创建服务帐户文件的电子邮件共享。
从命令行:
$ csv2gsheets --help
来自python代码:
fromcsv_export_gsheets.gsheetimportimport_csv# src - path to source CSV file or StringIO object# url - destination sheet url# cell - destination sheet cell (can include tab name: 'MyTab!A1')# credentials - path to service account credentials or dict# config - path to config file or dictimport_csv(source=src,url=url,cell=cell,credentials=credentials,config=config)
请注意:目的地工作表将在导入前清空。
待办事项
- 从google电子表格导出到csv