Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

I have a script which uses win32::ole to automate excel. Script is used for generate report. All of sudden, today while I was running the script I got "circular referrence" error. I run it almost every week but have never encountered this error. Does anyone know the reason behind this?

Thanks.

Replies are listed 'Best First'.
Re: circular reference in excel
by Corion (Patriarch) on Feb 23, 2010 at 17:23 UTC

    As you don't even tell us who/what raised the "circular reference" error, it's hard to tell. My guess is that your Excel sheet has a circular reference in some (chain of) formula. So, fix the Excel sheet.

Re: circular reference in excel
by Ratazong (Monsignor) on Feb 23, 2010 at 17:26 UTC

    You have probably generated a circular reference.

    The reason? How should we know without knowing your script nor your data??

    So prepare yourself for a serious debugging-session. The following hints may be helpful:

    • try to compare last weeks data with the current one - are there any special values?
    • and compare the amount of data - do you have more this week? And are you now crossing some hard-coded limits?
    • check all cells containing formulas - either in your excel-sheet or formulas written by your perl-script
    • check all cells referencing other cells: are some constant rows/columns referenced (which might now be overwritten by your script?)
    • try to "simulate" your script by hand, so you might find out when the circular reference occurs ... and if it is due to some data already present in your excel-sheet (e.g. a reference or a macro) or due to your perl-script
    • generate a lot of debugging-output to localize where the error occurs

    Good luck and happy debugging

    Rata

    PS.: don't forget to prepare a sufficient amount of coffee to support your efforts ;-)

Re: circular reference in excel
by Anonymous Monk on Feb 23, 2010 at 17:22 UTC

    Sounds like you've got a circular reference in there somewhere.

    For example, that means A1 = $B$2, B2 = $C$3, and C3 = $A$1, or some variation on the theme.