Search Results

Search found 12 results on 1 pages for 'xlwt'.

Page 1/1 | 1 

  • Python XLWT attempt to overwrite cell workaround

    - by PPTim
    Hi, Using the python module xlwt, writing to the same cell twice throws an error: Message File Name Line Position Traceback <module> S:\******** write C:\Python26\lib\site-packages\xlwt\Worksheet.py 1003 write C:\Python26\lib\site-packages\xlwt\Row.py 231 insert_cell C:\Python26\lib\site-packages\xlwt\Row.py 150 Exception: Attempt to overwrite cell: sheetname=u'Sheet 1' rowx=1 colx=12 with the code snippet def insert_cell(self, col_index, cell_obj): if col_index in self.__cells: if not self.__parent._cell_overwrite_ok: msg = "Attempt to overwrite cell: sheetname=%r rowx=%d colx=%d" \ % (self.__parent.name, self.__idx, col_index) raise Exception(msg) #row 150 prev_cell_obj = self.__cells[col_index] sst_idx = getattr(prev_cell_obj, 'sst_idx', None) if sst_idx is not None: self.__parent_wb.del_str(sst_idx) self.__cells[col_index] = cell_obj Looks like the code 'raise'es an exception which halts the entire process. Is removing the 'raise' term enough to allow for overwriting cells? I appreciate xlwt's warning, but i thought the pythonic way is to assume "we know what we're doing". I don't want to break anything else in touching the module.

    Read the article

  • Are xlrd and xlwt compatible?

    - by Leo
    I'm trying to create a workbook with python and I need to test the values of different cells to fill it but I'm having some troubles. I use xlrd and xlwt to create and edit the excel file. I've made a little example of my problem and I don't understand why it's not working. import xlwt import xlrd wb = xlwt.Workbook() ws = wb.add_sheet('Test') ws.write(0,0,"ah") cell = ws.cell(0,0) # AttributeError: 'Worksheet' object has no attribute 'cell' print cell.value I had taken for granted that xlrd and xlwt have shared classes which can interact with each other but it doesn't seem to be the case. How do I get the cell value of an open Worksheet object?

    Read the article

  • writing to existing workbook using xlwt

    - by Raj N
    I am unable to find examples where xlwt is used to write into existing files. I have a existing xls file that I need to write to. When I use xlrd to read the file, I cant seem to figure out how to transform the "Book" type returned into a xlwt.Workbook. I would appreciate if someone can point me to an example.

    Read the article

  • xlwt data garbled

    - by zhangzhong
    I retrieve the data of chinese characters from DB and write the data into excel by xlwt, code as below: ws0.write(unicode(cell, 'big5')) It is ok under Windows, but when I deloyed it under Linux, the data in excel garbled, Could you help to do with it?

    Read the article

  • Python - excel - xlwt: colouring every second row

    - by konjo
    Hi, i just finish some MYSQL to excel script with xlwt and I need to colour every second row for easy reading. I have tried this: row = easyxf('pattern: pattern solid, fore_colour blue') for i in range(0,10,2): ws0.row(i).set_style(row) Alone this colouring is fine, but when when I write my data rows are again white. Can some please show me some example 'cuz I m lost in coding :/ Best Regards.

    Read the article

  • How to have localized style when writing cell with xlwt

    - by lfagundes
    I'm writing an Excel spreadsheet with Python's xlwt and I need numbers to be formatted using "." as thousands separator, as it is in brazilian portuguese language. I have tried: style.num_format_str = r'#,##0' And it sets the thousands separator as ','. If I try setting num_format_str to '#.##0', I'll get number formatted as 1234.000 instead of 1.234. And if I open document in OpenOffice and format cells, I can set the language of the cell to "Portuguese (Brazil)" and then OpenOffice will show the format code as being "#.##0", but I don't find a way to set the cell's language to brazilian portuguese. Any ideas?

    Read the article

  • How to export user input data from python to excel?

    - by mrn
    I am trying to develop a user form in python 2.7.3. Please note that I am a python beginner. I am trying to use xlwt to export data to excel. I want to write values of following variables i.e. a (value to write:'x1') & d (value to write: be user defined information in text box), to an excel sheet, a=StringVar() checkBox1=Checkbutton(root, text="text1", variable=a, onvalue="x1", offvalue="N/A") checkBox1.place(relx=0., rely=0., relwidth=0., relheight=0.) checkBox1.pack() d=StringVar() atextBox1=Entry(root, textvariable=d, font = '{MS Sans Serif} 10') atextBox1.pack() Need help badly. Thank you so much in advance

    Read the article

  • How to export user input data from python (Tkinter) to excel? [migrated]

    - by mrn
    I am trying to develop a user form in python 2.7.3. Please note that I am a python beginner. I am trying to use xlwt to export data to excel. I want to write values of following variables i.e. a (value to write:'x1') & d (value to write: be user defined information in text box), to an excel sheet, a=StringVar() checkBox1=Checkbutton(root, text="text1", variable=a, onvalue="x1", offvalue="N/A") checkBox1.place(relx=0., rely=0., relwidth=0., relheight=0.) checkBox1.pack() d=StringVar() atextBox1=Entry(root, textvariable=d, font = '{MS Sans Serif} 10') atextBox1.pack()

    Read the article

  • Python - Finding unicode/ascii problems

    - by user330739
    Hi all, I am csv.reader to pull in info from a very long sheet. I am doing work on that data set and then I am using the xlwt package to give me a workable excel file. However, I get this error: UnicodeDecodeError: 'ascii' codec can't decode byte 0x92 in position 34: ordinal not in range(128) My question to you all is, how can I find exactly where that error is in my data set? Also, is there some code that I can write which will look through my data set and find out where the issues lie (because some data sets run without the above error and others have problems)?

    Read the article

  • How to export user inputs (from python) to excel worksheet?

    - by mrn
    I am trying to develop a user form in python 2.7.3. Please note that I am a python beginner. I am trying to use xlwt to export data to excel. I want to write values of following variables i.e. a (value to write:'x1') & d (value to write: be user defined information in text box), a=StringVar() checkBox1=Checkbutton(root, text="text1", variable=a, onvalue="x1", offvalue="N/A") checkBox1.place(relx=0., rely=0., relwidth=0., relheight=0.) checkBox1.pack() d=StringVar() atextBox1=Entry(root, textvariable=d, font = '{MS Sans Serif} 10') atextBox1.pack() Need help badly. Thank you so much in advance

    Read the article

1