I initially used "XLCreate>" to create what I thought was a pure csv file, but after file creation, a hex editor showed that the file really was an xls file, regardless of the file suffix ending.
So I abandoned creating the Excel file this way and did the GnuWin command "touch myfile.csv" which does create an empty Excel csv file which "XLOpen" successfully tackled.
However now I find that when I write the first line to the file using the "XLSetCell" command, it does set the data correctly, but puts tabs between the fields. Huh??? I thought this was a csv file.
I then closed the file and reopened it again on the 2nd and subsequent passes and this time XLSetCell correctly sets the line as comma-delineated data which is what I wanted for the first line. Much to my amazement the first line is quoted and then the fields are tabbed afterwards to match.
Is there anyway to get the first line written correctly with comma "," characters, not TAB characters?
Thanks for your help here.
Puzzled by first line in Excel behavior
Moderators: Dorian (MJT support), JRL
- CyberCitizen
- Automation Wizard
- Posts: 721
- Joined: Sun Jun 20, 2004 7:06 am
- Location: Adelaide, South Australia
This is a part of a script I had written originally to create a CSV file & had no issues with it.
You Could Also Read The File Once Done & Replace The TAB Character With A Comma.
Code: Select all
//Sets File Path & Header Attrib's
Let>FilePath=C:\%COMPUTER_NAME%.csv
Let>Header=Asset,Machine SN,Username,OS Type,Machine Boot Time,Logon Time,IP Address [LAN],IP Address [WiFi],Location
//Checks For Existing File
IfFileExists>%FilePath%,StartCollection,CreateFile
//Creates File If It Doesn't Exist
Label>CreateFile
WriteLn>%FilePath%,WriteResult,%Header%
Goto>StartCollection
Label>StartCollection
FIREFIGHTER
my fix
My fix was to create a small template csv file, with the data comma separated already. Then all I had to do was an XLOpen>file and append data to it.
When finished, since it was a pure CSV file, I simpled ignored the header line for good data.
Thank you for your reply.
I consider this question now closed.
When finished, since it was a pure CSV file, I simpled ignored the header line for good data.
Thank you for your reply.
I consider this question now closed.