lundi 31 août 2015

Download Google Sheet as CSV and keep numbers values as text

When I download one of my Google Sheets to csv, it removes the proceeding "0" from my values. For example, "0666666" will become "666666". How can I modify the code below so that it keeps that front zeros? Thanks!

def static_tabs():
    static_tabs = ('Locating Media','Schedules')
    for tab in static_tabs:
        edit_ws = edit.worksheet(tab)
        print ("EDIT"+format(edit_ws))
        filename = str(tab) +'.csv' 
        with open('C:/Users/A_DO/Dropbox/2. The Machine/10. Edit and QC Google Doc/Edit/Static Tabs/' + filename, 'wb') as f:
            writer = csv.writer(f,quoting=csv.QUOTE_ALL)
            writer.writerows(edit_ws.get_all_values())

static_tabs()



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire