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 Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 25, 2018, 14: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, 09:46
Default
  #2
New Member
 
Join Date: Sep 2016
Posts: 9
Rep Power: 9
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


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
Custom Thermophysical Properties wsmith02 OpenFOAM 4 June 1, 2023 14:30
[swak4Foam] groovyBC in openFOAM-2.0 for parabolic velocity bc ofslcm OpenFOAM Community Contributions 25 March 6, 2017 10:03
[OpenFOAM.org] Compile OF 2.3 on Mac OS X .... the patch gschaider OpenFOAM Installation 225 August 25, 2015 19:43
[swak4Foam] swak4foam building problem GGerber OpenFOAM Community Contributions 54 April 24, 2015 16:02
[OpenFOAM] Annoying issue of automatic "Rescale to Data Range " with paraFoam/paraview 3.12 keepfit ParaView 60 September 18, 2013 03:23


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