Modify

Opened 4 weeks ago

Closed 4 weeks ago

#13337 closed enhancement (fixed)

Support formulas like ExportImportXlsPlugin does

Reported by: dries.decock@… Owned by: Jun Omae
Priority: normal Component: TicketImportPlugin
Severity: normal Keywords:
Cc: Trac Release: 1.2

Description

We have would like to import an excel document based on a template we have. To do this, we added an additional tab containing all the information we want to import into trac. With the ExportImportXlsPlugin, the values are imported. But the TicketImportPlugin doesn't evaluate the formula but imports the formula.

Attachments (0)

Change History (5)

comment:1 Changed 4 weeks ago by Jun Omae

Type: defectenhancement

Could you please try the following patch?

  • talm_importer/readers.py

     
    172172    def __init__(self, filename, sheet_index, datetime_format):
    173173        self.fileobj = open(filename, 'rb')
    174174        self.book = openpyxl.load_workbook(filename=self.fileobj,
    175                                            read_only=True)
     175                                           read_only=True, data_only=True)
    176176        worksheets = self.book.worksheets
    177177        self.sheets_count = len(worksheets)
    178178        self.sheet = worksheets[sheet_index - 1]

comment:2 Changed 4 weeks ago by dries.decock@…

Perfect! That does the trick.

The only minor issue I still have is that formulas which produce an empty line will generate empty tickets.

Thanks!

comment:3 Changed 4 weeks ago by Jun Omae

Also, neither xlrd nor openpyxl can evaluate formula in Excel file. The stored value at last modified are returned.

See https://bitbucket.org/openpyxl/openpyxl/src/2.4.1/openpyxl/reader/excel.py?at=default&fileviewer=file-view-default#excel.py-138.

Last edited 4 weeks ago by Jun Omae (previous) (diff)

comment:4 Changed 4 weeks ago by Jun Omae

Owner: changed from François Granade to Jun Omae
Status: newaccepted

comment:5 Changed 4 weeks ago by Jun Omae

Resolution: fixed
Status: acceptedclosed

In 16997:

TicketImportPlugin: use a stored value for formula when openpyxl is used (closes #13337)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jun Omae.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.