• 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. How to open excel file in skill

Stats

  • Replies 13
  • Subscribers 162
  • Views 22082
  • Members are here 0
More Content

How to open excel file in skill

luanvn81
luanvn81 over 10 years ago

Hi all!

 I  have created a .csv file in my skill code, but I don't know how to open it  by skill, I have search out the function axlPdfView only. I don't know if is there  any function to open excel fife like that, Please show me to do that.

Thank you.

Luan.

  • Sign in to reply
  • Cancel
Parents
  • Kirti Sikri
    Kirti Sikri over 9 years ago

    Hello,

    If its a csv file delimited by same ,(comma) you want to open then you can open using regular file function infile, use gets to read lines from file as string and axlStringCSVParse to parse String as csv. Hope it helps

    For example if one has csv file,Book1.csv as following

    Instrument,CP,SP,Profit
    Keyboard,10.00 ,12.00 ,2.00
    Monitor,3.00 ,4.00 ,1.00
    Mouse,10.00 ,10.00 ,0.00

    Then Skill code to read the file and parse it as follows:

    csvFile = infile("Book1.csv") ; open the file for reading

    (while gets(curStr csvFile) ;gets reads a line from the input port and stores it as a string in a variable
    printf("curStr is %s\n" curStr)
    parsedStr=axlStringCSVParse(curStr) ;Parses a comma delimited line
    printf("parsedStr is %L count %d\n" parsedStr length(parsedStr))
    )

    close(csvFile)

    Output of running the load the skill file is:

    Command > skill load "excel.il"
    curStr is Instrument,CP,SP,Profit

    parsedStr is ("Instrument" "CP" "SP" "Profit") count 4
    curStr is Keyboard,10.00 ,12.00 ,2.00

    parsedStr is ("Keyboard" "10.00 " "12.00 " "2.00 ") count 4
    curStr is Monitor,3.00 ,4.00 ,1.00

    parsedStr is ("Monitor" "3.00 " "4.00 " "1.00 ") count 4
    curStr is Mouse,10.00 ,10.00 ,0.00

    parsedStr is ("Mouse" "10.00 " "10.00 " "0.00 ") count 4

    Notes:

    gets reads a line from the input port and stores it as a string in a variable. The string is also returned as the value of gets. The terminating newline character of the line becomes the last character in the string. gets returns nil if EOF is encountered and the variable maintains its last value

    axlStringCSVParse(
    t_string
    [g_stripWhite]
    ) -> lt_string/nil
    Description
    Parses a comma delimited line (typical from Excel). This differs from the Skill prehistorian function in several areas which make it compatible with Excel csv file format:
    ■ parseString ignores two adjacent commas.
    ■ if a comma is contained within a cell, Excel quotes the cell. parseString treats this as
    two cells.
    ■ Correctly processes double quotes in a cell.

    Arguments
    t_string A csv string
    g_stripWhite Option to strip leading and trailing white space from each output
    string. Default is to leave whitespace.

    Value Returned
    lt_string list of strings parsed based on comma separator.
    nil error (unlikely to happen)

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • Kirti Sikri
    Kirti Sikri over 9 years ago

    Hello,

    If its a csv file delimited by same ,(comma) you want to open then you can open using regular file function infile, use gets to read lines from file as string and axlStringCSVParse to parse String as csv. Hope it helps

    For example if one has csv file,Book1.csv as following

    Instrument,CP,SP,Profit
    Keyboard,10.00 ,12.00 ,2.00
    Monitor,3.00 ,4.00 ,1.00
    Mouse,10.00 ,10.00 ,0.00

    Then Skill code to read the file and parse it as follows:

    csvFile = infile("Book1.csv") ; open the file for reading

    (while gets(curStr csvFile) ;gets reads a line from the input port and stores it as a string in a variable
    printf("curStr is %s\n" curStr)
    parsedStr=axlStringCSVParse(curStr) ;Parses a comma delimited line
    printf("parsedStr is %L count %d\n" parsedStr length(parsedStr))
    )

    close(csvFile)

    Output of running the load the skill file is:

    Command > skill load "excel.il"
    curStr is Instrument,CP,SP,Profit

    parsedStr is ("Instrument" "CP" "SP" "Profit") count 4
    curStr is Keyboard,10.00 ,12.00 ,2.00

    parsedStr is ("Keyboard" "10.00 " "12.00 " "2.00 ") count 4
    curStr is Monitor,3.00 ,4.00 ,1.00

    parsedStr is ("Monitor" "3.00 " "4.00 " "1.00 ") count 4
    curStr is Mouse,10.00 ,10.00 ,0.00

    parsedStr is ("Mouse" "10.00 " "10.00 " "0.00 ") count 4

    Notes:

    gets reads a line from the input port and stores it as a string in a variable. The string is also returned as the value of gets. The terminating newline character of the line becomes the last character in the string. gets returns nil if EOF is encountered and the variable maintains its last value

    axlStringCSVParse(
    t_string
    [g_stripWhite]
    ) -> lt_string/nil
    Description
    Parses a comma delimited line (typical from Excel). This differs from the Skill prehistorian function in several areas which make it compatible with Excel csv file format:
    ■ parseString ignores two adjacent commas.
    ■ if a comma is contained within a cell, Excel quotes the cell. parseString treats this as
    two cells.
    ■ Correctly processes double quotes in a cell.

    Arguments
    t_string A csv string
    g_stripWhite Option to strip leading and trailing white space from each output
    string. Default is to leave whitespace.

    Value Returned
    lt_string list of strings parsed based on comma separator.
    nil error (unlikely to happen)

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
Children
No Data
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