Kirk,

Rob's plugin + below code should get you what you need:

Randy Engle




  // Method: 
  // EXCEL_TO_TAB_TEXT
  // ----------------------------------------------------
  // User name (OS): Randy
  // Date and time: 12/12/2019, 15:33:17
  // ----------------------------------------------------
  // Description
  // bld2770
  // 

  // V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^
  // V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^
  // V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^


C_LONGINT($book)
C_LONGINT($sheet)
C_LONGINT($startRow)
C_LONGINT($count_Rows)
C_LONGINT($startCol)
C_LONGINT($count_Columns)
C_TEXT($documentPath;$1)
C_TEXT($text_Value)
C_TEXT($packet)
C_TIME($doc_Ref)

$doc_Ref:=?00:00:00?

$documentPath:=$1

  //$documentPath:=System folder(Desktop)+"export.xlsx"

$CR:=Char(13)+Char(10)

Case of 
        : (Test path name($documentPath)=Is a document)
                
                $text_doc:=Replace string($documentPath;"xlsx";"txt")
                
                $doc_Ref:=Create document($text_doc)
                
End case 

Case of 
                
        : ($doc_Ref=?00:00:00?)
                  // Not created
                
        Else 
                
                $book:=xlBookLoadFile ($documentPath)
                
                If ($book#0)
                        
                          // Get a reference to the first sheet
                        $sheet:=xlBookGetSheet ($book;1)
                        
                        $startRow:=xlSheetGetFirstRow ($sheet)
                        $count_Rows:=xlSheetGetLastRow ($sheet)
                        
                        $startCol:=xlSheetGetFirstColumn ($sheet)
                        $count_Columns:=xlSheetGetLastColumn ($sheet)
                        
                        Open window(200;200;800;400;4;"Importing")
                        
                        For ($row;1;$count_Rows)
                                
                                $packet:=""
                                
                                For ($column;1;$count_Columns)
                                        
                                        $text_Value:=""
                                        
                                        $type:=xlSheetCellType 
($sheet;$row;$column)
                                        
                                        Case of 
                                                : ($type=xlCellType_Empty)  // 0
                                                        
                                                : ($type=xlCellType_Number)  //1
                                                        
$num_Value:=xlSheetGetCellNumber ($sheet;$row;$column)
                                                        
$text_Value:=String($num_Value)
                                                        
                                                : ($type=xlCellType_String)  //2
                                                        
$text_Value:=xlSheetGetCellText ($sheet;$row;$column)
                                                        
                                                : ($type=xlCellType_Boolean)  
//3
                                                        
$bool_Value:=xlSheetGetCellBoolean ($sheet;$row;$column)
                                                        
$text_Value:=String($bool_Value)
                                                        
                                                : ($type=xlCellType_Blank)  //4
                                                        
                                                : ($type=xlCellType_Error)  //5
                                                        
                                        End case 
                                        
                                        $packet:=$packet+$text_Value
                                        Case of 
                                                : ($column=$count_Columns)
                                                        
$packet:=$packet+Char(13)+Char(10)
                                                Else 
                                                        $packet:=$packet+Char(9)
                                        End case 
                                        
                                End for 
                                
                                SEND PACKET($doc_Ref;$packet)
                                
                                MESSAGE(String($row)+" of 
"+String($count_Rows)+$CR)
                                
                        End for 
                        
                        xlBookRelease ($book)
                        
                        CLOSE WINDOW
                        
                        CLOSE DOCUMENT($doc_Ref)
                        
                End if 
                
                
End case 

  // V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^
  // V^V^V^V^V^V^V^V^V    END OF METHOD   V^V^V^V^V^V^V^V^V^V^
  // V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^V^




**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to