A common request is to write ANSYS output to an Microsoft Excel file, so a user can double-click on the file to have it automatically open in Excel, rather than manually importing the data inside of Excel.  While ANSYS can’t create an .xls file, it can write data to text files.

If a comma-delimited text file is written by ANSYS with the file extension .csv, one can simply double-click on this file to open it in Excel (assuming that another program hasn’t associated the file extension .csv with itself). The same is true on Linux, with Gnumeric or KSpread or OpenOffice.org Calc/Spreadsheet, depending on which one you’ve associated with .csv files.

Below is a sample ANSYS input that meshes a simple block and writes out the node numbers and locations to a .csv file.  After running this input, you should find “test.csv” in the working directory and should be able to double-click on it to open its contents.

!----------------------------------------
! Create simple geometry & mesh
!----------------------------------------
/prep7
et,1,187
r,1
mp,ex  ,1,10e6
mp,nuxy,1,0.3
mp,dens,1,0.1/386.1

block,,1,,1,,1
block,,1,,1,,1
esize,,5
vmesh,all
vclear,1

!----------------------------------------
! Put node locations in array
! Use vector masks to account for
! non-consective numbering
!----------------------------------------
*get,AR99,node,,num,max
*dim,N_MASK,array,AR99
*dim,N_INFO,array,AR99,4
*vfill,N_INFO(1,1),ramp,1,1
*vget,N_MASK(1),node,,nsel
*vmask,N_MASK(1)
*vget,N_INFO(1,2),node,1,loc,x
*vmask,N_MASK(1)
*vget,N_INFO(1,3),node,1,loc,y
*vmask,N_MASK(1)
*vget,N_INFO(1,4),node,1,loc,z

!----------------------------------------
! Write information to .csv file
!----------------------------------------
*cfopen,test,csv
!----------------------------------------
! Fortran format example
!----------------------------------------
*vwrite('Node Number,x,y,z')
*vmask,N_MASK(1)
!----------------------------------------
! C-style format example
!----------------------------------------
*vwrite,N_INFO(1,1),N_INFO(1,2),N_INFO(1,3),N_INFO(1,4)
%i, %g, %g, %g
*cfclos