Exemple #1
0
def getRawFile(driveService, file_url):
	#Download the file
	resp, content = driveService._http.request(file_url)
	
	#Put the excel file into a xlrd workbook
	wb = xlrd.open_workbook(file_contents=content)
	
	#Now create a xlwt workbook
	new_wb = xlwt()
# -*- coding: utf-8 -*-
"""
# xlwt - створення електронних таблиць Excel
xlwt (http://pypi.org/project/xlwt) - бібліотека для створення електронних таблиць у форматі  Microsoft Excel 95-2003 на будь-якій платформі. В прикладі за допомогою xlwt 1.3.0 створюється робоча книга і лист Excel, в комірки якого заноситься значення і формула.
"""
import xlwt
workbook = xlwt.Workbook() # робоча книга Excel
sheet = workbook.add_sheet("Sheet1") # робочий лист
sheet.write(0, 0, 7.0) # записати в комірку 0, 0 значення
sheet.write(0, 1, xlwt.Formula("A1+2")) # записати в комірку 0, 1 формулу 
workbook.save("Book1.xls") # зберегти файл
Exemple #3
0
#!/usr/bin/env python
"""Convert multiple cvs files into xls.
Each csv file becomes one sheet in xls.
By default, tab-delimited (tabbed) files are processed. But it 
can be change with -d parameter.

Pre-requisities:
xlwt (http://scienceoss.com/write-excel-files-with-python-using-xlwt/)

Note: As Excell 97-2003 stores row number as 16 bit integer, 
it can handle 65536 rows at max! There is not way around this:/

Author:
[email protected]

Barcelona, 21/03/2012
"""

import os, sys
from optparse import OptionParser
from datetime import datetime

#try to import module for xls handling
try:
    from xlwt import *  #import xlwt #http://scienceoss.com/write-excel-files-with-python-using-xlwt/
except:
    #sys.stderr.write("xlwt not installed!\nHave a look at how to install it on: http://scienceoss.com/write-excel-files-with-python-using-xlwt/\n")
    sys.stderr.write(
        "Install xlwt first: sudo apt-get install python-xlwt OR conda install xlwt\n"
    )
    sys.exit(1)
Exemple #4
0
#!/usr/bin/env python
"""Convert multiple cvs files into xls.
Each csv file becomes one sheet in xls.
By default, tab-delimited (tabbed) files are processed. But it 
can be change with -d parameter.

Pre-requisities:
xlwt (http://scienceoss.com/write-excel-files-with-python-using-xlwt/)

Note: As Excell 97-2003 stores row number as 16 bit integer, 
it can handle 65536 rows at max! There is not way around this:/

Author:
[email protected]

Barcelona, 21/03/2012
"""

import os, sys
from optparse import OptionParser
from datetime import datetime

#try to import module for xls handling
try:
    from xlwt import * #import xlwt #http://scienceoss.com/write-excel-files-with-python-using-xlwt/
except:
    #sys.stderr.write("xlwt not installed!\nHave a look at how to install it on: http://scienceoss.com/write-excel-files-with-python-using-xlwt/\n")
    sys.stderr.write("Install xlwt first: sudo apt-get install python-xlwt\n")
    sys.exit(1)
##Excell formatting
f = Font()