LISP TXT to XLS

Discussion in 'AutoCAD' started by avib120, May 24, 2004.

  1. avib120

    avib120 Guest

    I have a table of 520 rows and 4 columns in AutoCad. Each cell is in a single text format. I need to transfer this table into an excel file. Does anyone know how to do this using lisp routine?

    Thank
     
    avib120, May 24, 2004
    #1
  2. avib120

    randy benson Guest

    I know how I'd _approach_ it:

    1) Select the text from the table and open a file for writing
    (setq ss (ssget '((0 . "TEXT")))
    cnt 0
    len (strlen (getvar "dwgname"))
    f (open (strcat
    (getvar "DWGPREFIX")
    (substr (getvar "DWGNAME") 1 (- len 4))
    ".DMP"
    )
    "w"
    )
    )

    2) Sort it by the y-value of the text insertion points (Tony Tanzillo's
    lsort routine is perfect for this).

    3) Write each line to the file:
    (write-line (strcat column1 "," column2 "," column3 "," column4) f)

    4) Close the file. (close f)


    single text format. I need to transfer this table into an excel file. Does
    anyone know how to do this using lisp routine?
     
    randy benson, May 24, 2004
    #2
  3. avib120

    randy benson Guest

    1a) Change the ".DMP" to ".CSV" in your case.
    ....
    5) Open the resulting file in Excel and save as "filename.XLS".
     
    randy benson, May 24, 2004
    #3
  4. avib120

    ECCAD Guest

    Sure,
    Just E-Mail me a 'sample' drawing, & I'll email back the Lisp.
    No charge.

    Bob Shaw
    www.bobscadshop.com
     
    ECCAD, May 24, 2004
    #4
  5. avib120

    ECCAD Guest

    Avi,
    You should have the lisp now.
    Cheers.

    Bob
     
    ECCAD, May 24, 2004
    #5
  6. avib120

    kozmos Guest

    kozmos, May 25, 2004
    #6
  7. Alan Henderson @ A'cad Solutions, May 27, 2004
    #7
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.