🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

Using TWAPI for Writing Data to Excel

User: "Girish2121"
Altair Community Member
Updated by Girish2121

Hi all,

 

I am looking out for any examples to write stress/node id data to excel sheet TWAPI in Tcl/Tk.

 

Thanks in advance,

Regrads,

Girish C Hirekerur

Find more posts tagged with

Sort by:
1 - 4 of 41
    User: "tinh"
    Altair Community Member
    Updated by tinh

    Hi,

    If you just want to write raw data, write it as CSV text format (can be opened by excel)

    example

    set fpt [open example.csv w]

    puts $fpt 'NodeID,StressValue'

    puts $fpt [join 1 100]

    puts $fpt [join 2 200]

    puts $fpt [join 3 300]

    close $fpt

     

     

    ==> open example.csv by excel to see

    User: "Girish2121"
    Altair Community Member
    OP
    Updated by Girish2121

    Hi Tinh,

     

    I need to write the data from Hyperview in an organised readable manner.I referred to an example as given below :

     

      package require twapi
       
      set excel [::twapi::comobj Excel.Application]
      $excel DisplayAlerts [expr 0]
       
      set workbooks [$excel Workbooks]
      $workbooks Open 'C:/Users/willblatt/BlattBros/Projects/10000 Temp/XLS_Files_Chip/CHIP_ASSAY_TABLE.xlsx'
       
      set workbook [$workbooks Item 1]
      set sheets [$workbook Sheets]
      set sheet [$sheets Item 1]
      set cells [$sheet range a1 c3]
       
      puts [$cells Value]
       
      $cells -destroy
      $sheet -destroy
      $sheets -destroy
      $workbook -destroy
      $workbooks -destroy
      $excel Quit
     

    $excel -destroy

     

    I tried to use the above example.

    i.How should I add New Sheet to the file.

    ii.Can change the name of the file from Sheet1,Sheet2,etc. to something different say :Normal Force,Axial Force.etc

    iii. Any detailed documentation of all the classes available in TWAPI ?

     

    Thanks in advance,

    Girish

    User: "tinh"
    Altair Community Member
    Updated by tinh

    Hi,

    there is document of using twapi. you can search it on google

    for excel COM, perhaps you should look at MSDN

    https://msdn.microsoft.com/en-us/library/office/ff193217.aspx

    User: "Altair Forum User"
    Altair Employee
    Updated by Altair Forum User

    Why need XLS when you can make CSV?