Jump to content

EXCEL FILES PROBLEM


Guest ronald
 Share

Recommended Posts

Guest ronald

HELLO To ALL WHAT I MUST DO IT IS TO READ The INFORMATION OF A EXCEL BOOK THAT I HAVE And THIS SAME INFORMATION IS WRITTEN IN A PAGUINA OF Internet, (The INFORMATION CAN BE SEPARATED BY COMMAS IN EXCEL)

Link to comment
Share on other sites

I am assuming that this:

(The INFORMATION CAN BE SEPARATED BY COMMAS IN EXCEL)

means it can be in a .csv file, if that is the case, i wrote a function awhile ago that pulls data from the .csv file here it is:

;-------------------------------------------------------
;Function Name: table_cell_val()
;Purpose: This function goes into the table and retrieves
;        the data from the cell. Which cell it looks in
;        is determined by the parameters passed.
;Parameters: $table - The data table to use
;           $colName - The name of the column that the
;                      cell is located in.
;           $row - Which row to use. *NOTE = row 1 is
;                  the column name row.
;-------------------------------------------------------
Func table_cell_val($table, $colName, $row)
  $colNum = 1

  $handle_a = FileOpen($table, 0)

 ; Check if file opened for reading OK
  If $handle_a = -1 Then
    MsgBox(0, "Error", "Unable to open table.")
    Exit
  EndIf

  $string = FileReadLine($table, 1)
  $array = StringSplit($string, ","); Splits up the location string
  $totCol = $array[0]
  While $colNum <= $totCol
    If ($colName == $array[$colNum]) Then
      ExitLoop
    Else
      $colNum = $colNum + 1
    EndIf
  Wend

  $totRow = _FileCountLines($table)
  
  $string = FileReadLine($table, $row)
  $array = StringSplit($string, ","); Splits up the location string
  $ret = $array[$colNum]

  FileClose($handle_a)

  Return $ret
EndFunc

Hope that helps...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...