Parse error when using VLOOKUP

876 views
Skip to first unread message

ShadowHywind

unread,
Aug 31, 2009, 11:57:06 AM8/31/09
to python-excel
What I am trying to do, is do a VLOOKUP on another sheet, on another
workbook(file). However everytime I try, I keep getting 'Exception:
can't parse formula VLOOKUP(A1;[master.xls]week34!A2:AD200;24;0)' The
only thing that I think is causing the issue with the '[master.xls]'
anyone have any ideas on how to get around this issue? Thanks

Not sure if I am allowed to post the code, but here is the code that
is giving me problems

from pyExcelerator import *
import pyExcelerator
import os

excelFile = "file1.xls"
masterFile = "master.xls"
wb = Workbook()
ws0 = wb.add_sheet('a')
ws0.write(0, 0, Formula("VLOOKUP(A1;[master.xls]week34!
A2:AD200;24;0)"))
wb.save(excelFile)

Chris Withers

unread,
Aug 31, 2009, 12:05:08 PM8/31/09
to python...@googlegroups.com
ShadowHywind wrote:
> from pyExcelerator import *
> import pyExcelerator

Why on earth are you using pyExceleraturd?

Please try with xlwt, a directly compatible fork of pyExcelerator, and
see if it solves the problem:

http://pypi.python.org/pypi/xlwt

It may not, but you'll be in a much better place...

Chris

--
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk

ShadowHywind

unread,
Aug 31, 2009, 12:19:57 PM8/31/09
to python-excel
I have tried with xlwt, and I get
'xlwt.ExcelFormulaParser.FormulaParseException: can't parse formula
VLOOKUP(A1;[master.xls]week34!A2:AD200;24;0)' So I think my issue is
still with the [master.xls]

the revised code(to use xlwt)
from xlwt import *
import xlwt
import os

excelFile = "file1.xls"
masterFile = "master.xls"
wb = Workbook()
ws0 = wb.add_sheet('a')
ws0.write(0, 0, Formula("VLOOKUP(A1;[master.xls]week34!
A2:AD200;24;0)"))
wb.save(excelFile)

Thomas P. Boesen

unread,
Aug 31, 2009, 1:16:36 PM8/31/09
to python...@googlegroups.com
Hi,
Try replacing the semicolons with commas - the semicolons are used by
Excel when comma is used as the decimal point, but the conversion is
handled by Excel at runtime, so you might have to use the English
notation here.
:-) Thomas

ShadowHywind

unread,
Aug 31, 2009, 1:31:52 PM8/31/09
to python-excel
I switched the semicolons to comma's and still the same error

John Machin

unread,
Aug 31, 2009, 6:12:24 PM8/31/09
to python...@googlegroups.com
On 1/09/2009 3:16 AM, Thomas P. Boesen wrote:
> Hi,
> Try replacing the semicolons with commas - the semicolons are used by
> Excel when comma is used as the decimal point, but the conversion is
> handled by Excel at runtime, so you might have to use the English
> notation here.
> :-) Thomas

That won't help. pyExcelerator expects ';' -- the author (Roman V.
Kiseliov) used what applied in his locale). Recent versions of xlwt
allow either ',' or ';' (or a mixture in the same formula) as the list
separator.

The problem with the OP's VLOOKUP is that neither pyExcelerator nor xlwt
support references to external files in formulas.

Cheers,

John

ShadowHywind

unread,
Aug 31, 2009, 10:45:01 PM8/31/09
to python-excel
I was starting to think that xlwt wasn't capable of accessing external
files. I think I will just take it a step farther, and use xlrd and
just create my own vlookup that way. Thanks for the help anyways.
Reply all
Reply to author
Forward
0 new messages