LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  Importing Mulitple Excel Files

    Employee
    Posted 07-18-2011 01:18

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: Pooja

    Hi,

    I'm trying to import mulitple excel files using a directory node followed by the 'excel file' node.

    I'm able to import the files individually but keep getting a Phython exception when I try and import 2 files.

    Any ideas as to why this would happen?

    Thanks

    Pooja


  • 2.  RE: Importing Mulitple Excel Files

    Employee
    Posted 07-18-2011 06:06

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: Tim Meagher

    Hi,

    I assume that you are referring to the experimental Excel File node in the core library.

    What is the error that you are seeing - and how have you configured the node?
    Are you using the WorkbookSpec parameter?

    This could be due to the fact that the metadata (or header row) in one of the worksheets from the two files does not match.

    If you post the error, it should be possible to determine what the problem is.

    Tim.


  • 3.  RE: Importing Mulitple Excel Files

    Employee
    Posted 07-18-2011 08:49

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: Pooja

    Hi Tim,

    The error messae is: -
    Got Python exception

    Installing log (07/18/2011 16:17:23) ...
    2011-07-18 16:17:30; Level: 3; Type: 0; Desc: "Incompatible metadata on sheet 0 of workbook \\Cpwplc.com\data\CPW-UK_GD\=NETWORK_COMPLIANCE=\Task Management\Revenue Assurance (R&D)\Sales Assurance\O2\Data\Payment Files\Base upgrades/O2 Base Upgrades 201102.xls"; File: "ls.brain.node.brainpython.python2implementationfi le"; Line: 186; Context: "buildMetadata( ) - Exception"
    2011-07-18 16:17:30; Level: 3; Type: 0; Desc: "Error pumping node (Traceback (most recent call last):
    File "C:\Program Files\Lavastorm\LAE 4.5\lib\python\lavastorm\brain\python1.py", line 913, in Run
    while n.pump(quant):
    File "C:\BRAINscratch\tmp\brain\O2_Reconciliation+v3\de fault\temp.UK007351.3088.396.1311002243629.prop", line 217, in pump
    self.buildMetadata(workbook, sheet, sheetCfg, currentOutput, self.metadataBuilt, inFile)
    File "C:\BRAINscratch\tmp\brain\O2_Reconciliation+v3\de fault\temp.UK007351.3088.396.1311002243629.prop", line 186, in buildMetadata
    raise braininfo.BrainNodeException, "Incompatible metadata on sheet %s of workbook %s" % (outputIndex, filename)
    BrainNodeException: Incompatible metadata on sheet 0 of workbook \\Cpwplc.com\data\CPW-UK_GD\=NETWORK_COMPLIANCE=\Task Management\Revenue Assurance (R&D)\Sales Assurance\O2\Data\Payment Files\Base upgrades/O2 Base Upgrades 201102.xls
    )"; File: "ls.brain.node.brainpython.python2implementationfi le"; Line: 186; Context: "buildMetadata( ) - Exception"
    Uninstalling log (07/18/2011 16:17:30) ...

    Error in sys.excepthook:Traceback (most recent call last): File "C:\Program Files\Lavastorm\LAE 4.5\lib\python\lavastorm\brain\python1.py", line 948, in <lambda> return lambda exc, value, tb: Python1ExceptHook(control, exc, value, tb)TypeError: 'NoneType' object is not callableOriginal exception was:Traceback (most recent call last): File "C:\BRAINscratch\tmp\brain\O2_Reconciliation+v3\de fault\temp.UK007351.3088.397.1311002243645.prop", line 1, in <module> import lavastorm.brain.python1 File "C:\Program Files\Lavastorm\LAE 4.5\lib\python\lavastorm\brain\python1.py", line 957, in <module> runMain() File "C:\Program Files\Lavastorm\LAE 4.5\lib\python\lavastorm\brain\python1.py", line 955, in runMain raise BrainNodeException, "Encountered error running node"lavastorm.brain.python1.BrainNodeException: Encountered error running node

    -------------------------------------
    The header rows match exactly. I can't upload .xls files - do you want me save them down as .txts and send them through? Although if there is a problem with one of the other tabs it might be difficult to detect that.

    Thanks

    Pooja
    Attachments:
    Import Excel Files.brg


  • 4.  RE: Importing Mulitple Excel Files

    Employee
    Posted 07-19-2011 02:00

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: Tim Meagher

    Hi,

    Yeah I think I will need to look at the Excel files as it is complaining about a metadata mismatch, and it's difficult to determine what the problem is without looking at the files.
    You shouldn't need to do anything with the files in Excel (i.e. don't do a save as a different file type or anything), just make a copy of the files, and change the extension manually in Windows Explorer to .txt, then upload.

    Alternately, you could zip them both up and attach.
    I'm pretty certain you can upload zip files to the forums.

    Tim.


  • 5.  RE: Importing Mulitple Excel Files

    Employee
    Posted 07-19-2011 03:12

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: Pooja

    Hi Tim,

    I've attached the files.

    Thanks

    Pooja


  • 6.  RE: Importing Mulitple Excel Files

    Employee
    Posted 07-19-2011 04:47

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: Tim Meagher

    Hi,

    It looks like the problem is that the "Tariff" field is capitalized in the header row one of the files, but not the other.
    One way to work around this is to change the Excel file to have them both lowercase or both capitalized.
    Alternately, you can specify all of the field names within the WorkbookSpec parameter as follows:

    <workbook>
    	<sheet name="Detail" dataStartRow="2">
    		<field name="month"/>
    		<field name="SOS CODE"/>
    		<field name="Date"/>
    		<field name="MOBILE"/>
    		<field name="Group Type"/>
    		<field name="Tariff"/>
    		<field name="Bonus"/>
    		<field name="comment"/>
    		<field name="URN"/>
    		<field name="Band"/>
    		<field name="refuse"/>
    		<field name="Reason"/>
    	</sheet>
    </workbook>
    As a side note, we are planning on upgrading the Excel File node in LAE 4.5.2, and making this part of the core product, rather than being experimental. While the new version will be similar to the existing one, there are some extra features for metadata management (specifying whether you want a union, intersection, or error on missing & extra fields).

    Although you would still end up wanting to do something similar to the above with the worksheets you have, in the newer version to be released in the coming months, at least the error message you receive would have pointed out exactly which field did not match.

    Tim.


  • 7.  RE: Importing Mulitple Excel Files

    Employee
    Posted 07-20-2011 02:06

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: Pooja

    Thanks Tim,

    It's worked

    Pooja


  • 8.  RE: Importing Mulitple Excel Files

    Employee
    Posted 07-20-2011 02:16

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: Tim Meagher

    No worries.

    By the way, I mentioned in a previous post that
    			
    				you would still end up wanting to do something similar to the above with the worksheets you have
    			
    
    when the new version of the Excel File node is released.

    This is incorrect and the new version when released will merge the metadata from the different sheets in a case-insensitive manner - as is consistent with other nodes in the LAE.

    Regards,
    Tim.