CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Mesh Generation & Pre-Processing Software > ANSA

Ansa Scripting (Open Excel/.txt file)

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 25, 2018, 15:11
Default Ansa Scripting (Open Excel/.txt file)
  #1
New Member
 
wkg
Join Date: May 2018
Posts: 2
Rep Power: 0
gohwaikien is on a distinguished road
Hi,

I was trying to open excel file and text file using ANSA scripting with
utils.XlsxOpen and it didn't work. Does anyone have any idea?
gohwaikien is offline   Reply With Quote

Old   September 3, 2018, 10:46
Default
  #2
New Member
 
Join Date: Sep 2016
Posts: 9
Rep Power: 5
acurley31 is on a distinguished road
Make sure your import statements are correct. You may also want to check your file path that you are trying to open from within the script to make sure it actually exists.

Code:
# Importing just ansa
import os
import ansa

filename = "/path/to/my/xlsx/file"
fileExists = os.path.exists(filename)    # Check to make sure the file exists

xl_element = ansa.utils.XlsxOpen(filename)
ansa.utils.XlsxClose(xl_element)

Code:
# Importing ansa.utils
from ansa import utils

xl_element = utils.XlsxOpen(filename)
utils.XlsxClose(xl_element)
acurley31 is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[swak4Foam] groovyBC in openFOAM-2.0 for parabolic velocity bc ofslcm OpenFOAM Community Contributions 25 March 6, 2017 11:03
[OpenFOAM.org] Compile OF 2.3 on Mac OS X .... the patch gschaider OpenFOAM Installation 225 August 25, 2015 20:43
Custom Thermophysical Properties wsmith02 OpenFOAM 3 July 27, 2015 06:37
[swak4Foam] swak4foam building problem GGerber OpenFOAM Community Contributions 54 April 24, 2015 17:02
[OpenFOAM] Annoying issue of automatic "Rescale to Data Range " with paraFoam/paraview 3.12 keepfit ParaView 60 September 18, 2013 04:23


All times are GMT -4. The time now is 11:20.