I am using python to upload a csv file to Google Drive. The csv file uses decimal point as the decimal separator mark, but when converted to google spreadsheet misconversions come up:
Example: a decimal number 1.10 is taken as text (aceptable), but sometimes is converted to a date string, which renders the number unreadable.
This is the code:
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, the language setting of the spreadsheet document or the language of the Drive interface will be responsible for the conversion using decimal point or decimal comma.
Can the interface language of Google Drive be requested? (So I can prepare the csv file accordingly)
Can the language of my uploaded file be set using metadata? (So it can match the language of the interface)
May you have another way of getting csv file correctly converted into google spreadsheet?
Can the interface language of Google Drive be requested?
yes, you can get the user information using
info = drive.auth.service.about().get().execute()
Then the language will be given by info['languageCode']
. The style will be en_US
for example.
From info
you can get the name, email, total storage available, etc.
info['name']
info['user']['emailAddress']
info['quotaBytesUsed']