|
|
|||||||
Hi guys, first post so go easy on me I had a search for the answer but couldn't find it basically I have a login script which I have inherited, I want it to write an entry into a csv file to update it with some info what commmand do you need to use? |
||||||||
|
|
|||||||
Hi and welcome to the board. You could use writeline to write to a csv file. Code: Break on ; ;Open the file. $rc = Open (1, "c:\somefile.csv", 5) ; ;Write stuff to the file. $rc = WriteLine (1, "some data to write to the csv file" + @CRLF) ; ;Close the file. $rc = Close (1) |
||||||||
|
|
|||||||
The CSV UDF assures a properly formatted CSV record. Send it an array, you get a CSV string. Send it a CSV string, you get an array. So, if you load your data into an array, it becomes this simple: Code: $array = 'data', 'data', 'more data' ... $RC = RedirectOutput('your_log.csv') CSV($array) ; csv string is not captured, just written to StdOut $RC = RedirectOutput('') Glenn |
||||||||
|
|
|||||||
However, you will have to ensure that you send in the correct amount of data. A CSV file is essentially a table where the columns are being separated by commas (enclose strings with quotation marks in case they could contain commas), and each line represents a row. |