• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Allegro X PCB Editor
  3. Excel File Reading Question

Stats

  • Replies 5
  • Subscribers 160
  • Views 15418
  • Members are here 0
More Content

Excel File Reading Question

thewill2live
thewill2live over 10 years ago

Hey Guys,

I'm trying to read in an excel file to get some data and display it on a GUI. I have been trying the following:

file = axlDMFileBrowse("MISC" nil)
print(file) ;DEBUG
if( axlSpreadsheetRead(file)
then
println("Successfully Read spreadsheet!") ;DEBUG
println(axlSpreadsheetGetCell(1,1)) ;DEBUG
)

with test.xlsx file and get this error:

E- (SPMHWB-110): Error importing XML file An exception occurred! Type:UTFDataFormatException, Message:invalid byte 1 (‚) of a 1-byte sequence..

I'm guessing this means that Allegro doesn't like .xlsx files, so I tried the same with a test2.xls file and got pretty much the same error:

E- (SPMHWB-110): Error importing XML file An exception occurred! Type:UTFDataFormatException, Message:invalid byte 2 (Ï) of a 2-byte sequence..
E- (SPMHWB-110): Error importing XML file .

Both times it dies on the axlSpreadsheetRead command. My temporary work around is to use .csv files and change to the axlSpreadsheetReadDelimited command which is working fine but I'd like to know what I'm doing wrong on the excel side as I would like to be able to support all 3 file types (xlsx, xls, and csv). Anyone have an idea where I went wrong?

Bonus question: Does SKILL have an exception handling method? I attempted to follow a tutorial for LISP exception handling using the "Condition" system but Allegro didn't like that when I attempted to run it. I'm hoping there something along the lines of the python try/except/else statement that will allow me to put some exception handling abilities into my program. Does this exist?

  • Sign in to reply
  • Cancel
  • fxffxf
    fxffxf over 10 years ago

    Try  after axlSpreadsheetRead

       axlSpreadsheetGetWorksheets to get worksheets in file

    then set active worksheet

        axlSpreadsheetSetWorksheet(< a worksheet from above>)

    then axlSpreadsheetGetCell

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • thewill2live
    thewill2live over 10 years ago

    I updated the code to the following:

    file = axlDMFileBrowse("MISC" nil)
    print(file) ;DEBUG
    axlSpreadsheetRead(file)
    print("Got past READ line");DEBUG
    wrksht = axlSpreadsheetGetWorksheets()
    print("Got past Get Worksheet line");DEBUG
    axlSpreadsheetSetWorksheets(nth(0 wrksht))
    print("Got past Set Worksheet line");DEBUG
    cell = axlSpreadsheetGetCell(1,1)
    print("Got past Get Cell line");DEBUG
    println(cell)

    But never get past the axlSpreadsheetRead(file) line anyways. Same error as above occurs.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • B Bruekers
    B Bruekers over 10 years ago

    From the documentation:

    The axlSpreadsheet family of functions allow you to read and write Microsoft's open XML- based spreadsheet format from within skill.

    This means you can only read / write XML based files. So xls and xlsx are not supported. 

    You could write a VBS script and run it with 'csrcipt' to first save the XLS file to a XML format and then import it.

    Same for exporting/merging data into a XLS file. 

    All this you can do from SKILL. 

    For the exception handling use errset().

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • thewill2live
    thewill2live over 10 years ago

    It is my understanding that .xlsx was the microsoft open XML-based spreadsheet (as opposed to .xls which is the older non-xml version). So if this is not true, can you give me an example of what file type IS supported by the axlSpreadsheet commands (aside from the .csv file)? 

    For the exception handling, thanks I'll take a look at that function.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Ejlersen
    Ejlersen over 10 years ago

    Hi

    I would recommend that you read the information in %cdsroot%\share\pcb\examples\skill\doc\funcs\axlSpreadsheetDoc.txt 

    It contains a sample that writes a spreadsheet (in .xml format) - from there you can see the format and how to read it.

    Best regards

    Ole

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Cadence Guidelines

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information