我如何从 pyDrive 请求 csv 转换为 google 正确处理小数点分隔符的电子表格?

How can I request from pyDrive a csv conversion to google spreadsheet that handles correctly the decimal separator mark?

我正在使用 python 将 csv 文件上传到 Google 驱动器。 csv 文件使用小数点作为小数点分隔符,但在转换为 google 电子表格时出现错误转换:

示例:十进制数 1.10 被视为文本(可接受),但有时会被转换为日期字符串,从而导致该数字不可读。

这是代码:

metadata = {'title' : cloud_filename, 
            'parents':  [{"kind": "drive#fileLink","id": parent_id}]}
file1 = drive.CreateFile(metadata)
file1.SetContentFile(local_filepath)
file1.Upload({'convert':True})  # Upload the file.

According to this thread in Google Drive Help Forum,电子表格文档的语言设置或Drive界面的语言将负责转换为小数点或小数逗号。

Can the interface language of Google Drive be requested?

是的,您可以使用

获取用户信息
info = drive.auth.service.about().get().execute()

然后info['languageCode']会给出语言。例如,样式将为 en_US

info 您可以获取姓名、电子邮件、可用的总存储空间等。

info['name']
info['user']['emailAddress']
info['quotaBytesUsed']