Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #56968
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <sameercool87@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.020 |
| X-Spam-Evidence | '*H*': 0.96; '*S*': 0.00; 'else:': 0.03; 'everyone!': 0.07; 'suppose': 0.07; 'append': 0.09; 'subject:using': 0.09; 'subject:How': 0.10; 'python': 0.11; 'suggest': 0.14; 'archive': 0.14; 'context:': 0.16; 'exists,': 0.16; 'url:irs': 0.16; 'xlrd': 0.16; 'trying': 0.19; 'example': 0.22; 'import': 0.22; 'print': 0.22; 'url:gov': 0.24; 'excel': 0.26; 'code': 0.31; '25,': 0.31; 'anyone': 0.31; 'file': 0.32; 'url:python': 0.33; 'problem': 0.35; 'charset:us-ascii': 0.36; 'subject:?': 0.36; 'list': 0.37; 'skip:o 20': 0.38; 'checks': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'unable': 0.39; 'mailing': 0.39; 'new': 0.61; 'simple': 0.61; 'information': 0.63; 'here': 0.66; 'url:pdf': 0.68; 'containing': 0.69; 'default': 0.69; "skip:' 110": 0.84; 'hyperlinks': 0.91; 'sheets': 0.91; 'sheet': 0.93 |
| Date | Thu, 17 Oct 2013 08:15:41 -0700 (PDT) |
| From | Sameer Gupta <sameercool87@gmail.com> |
| To | python-list@python.org |
| Subject | How to copy hyperlinks using xlrd, xlwt and xlutils? |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Transfer-Encoding | 7bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1166.1382022974.18130.python-list@python.org> (permalink) |
| Lines | 68 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1382022974 news.xs4all.nl 15868 [2001:888:2000:d::a6]:57435 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:56968 |
Show key headers only | View raw
Hello Everyone!
*Problem:*
I am trying a simple code for writting excel sheet. The program checks if
the Excel sheet already exists, If the file exists, then it append it with
the new data. The problem is I am unable to copy hyperlinks. I would be very
thankful if anyone can suggest me some way.
*Note:* I had used here some default example for hyperlinks. I will be using
this information for my other program where I am suppose to edit excel sheet
with many sheets and every sheet containing hyperlinks at multiple places.
*Code: *
from xlwt import *
import xlrd as xr
import os
from xlutils.copy import copy
name=r"hyperlinks.xls"
if os.path.exists(name)==True:
print "Excel sheet already exists!!!"
cwb=xr.open_workbook(name,formatting_info=True)
w=copy(cwb)
temp=cwb.sheet_by_index(0)
ws=w.get_sheet(0)
row=len(temp.col_values(0))
f = Font()
f.height = 20*72
f.name = 'Verdana'
f.bold = True
f.underline = Font.UNDERLINE_DOUBLE
f.colour_index = 4
h_style = XFStyle()
h_style.font = f
n = "HYPERLINK"
ws.write_merge(row+1, row+1,1, 10, Formula(n +
'("http://www.irs.gov/pub/irs-pdf/f1000.pdf";"f1000.pdf")'), h_style)
ws.write_merge(row+2, row+2, 2, 25, Formula(n +
'("mailto:roman.kiseliov@gmail.com?subject=pyExcelerator-feedback&Body=Hello,%20Roman!";"pyExcelerator-feedback")'),
h_style)
w.save("hyperlinks.xls")
else:
f = Font()
f.height = 20*72
f.name = 'Verdana'
f.bold = True
f.underline = Font.UNDERLINE_DOUBLE
f.colour_index = 4
h_style = XFStyle()
h_style.font = f
w = Workbook()
ws = w.add_sheet('F')
n = "HYPERLINK"
ws.write_merge(1, 1, 1, 10, Formula(n +
'("http://www.irs.gov/pub/irs-pdf/f1000.pdf";"f1000.pdf")'), h_style)
ws.write_merge(2, 2, 2, 25, Formula(n +
'("mailto:roman.kiseliov@gmail.com?subject=pyExcelerator-feedback&Body=Hello,%20Roman!";"pyExcelerator-feedback")'),
h_style)
w.save("hyperlinks.xls")
--
View this message in context: http://python.6.x6.nabble.com/How-to-copy-hyperlinks-using-xlrd-xlwt-and-xlutils-tp5036209.html
Sent from the Python - python-list mailing list archive at Nabble.com.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
How to copy hyperlinks using xlrd, xlwt and xlutils? Sameer Gupta <sameercool87@gmail.com> - 2013-10-17 08:15 -0700
csiph-web