Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(AutoIt) Create CSV FileDemonstrates how to create a new CSV file with some simple content.
; This sample code creates a new CSV file (sample.csv) ; that contains this content: ; ; year,color,country,food ; 2001,red,France,cheese ; 2005,blue,"United States",hamburger $oCsv = ObjCreate("Chilkat.Csv") ; Indicate that the 1st row ; should be treated as column names: $oCsv.HasColumnNames = True Local $bSuccess = $oCsv.SetColumnName(0,"year") $bSuccess = $oCsv.SetColumnName(1,"color") $bSuccess = $oCsv.SetColumnName(2,"country") $bSuccess = $oCsv.SetColumnName(3,"food") $bSuccess = $oCsv.SetCell(0,0,"2001") $bSuccess = $oCsv.SetCell(0,1,"red") $bSuccess = $oCsv.SetCell(0,2,"France") $bSuccess = $oCsv.SetCell(0,3,"cheese") $bSuccess = $oCsv.SetCell(1,0,"2005") $bSuccess = $oCsv.SetCell(1,1,"blue") $bSuccess = $oCsv.SetCell(1,2,"United States") $bSuccess = $oCsv.SetCell(1,3,"hamburger") ; Write the CSV to a string and display: Local $sCsvDoc $sCsvDoc = $oCsv.SaveToString() ConsoleWrite($sCsvDoc & @CRLF) ; Save the CSV to a file: $bSuccess = $oCsv.SaveFile("out.csv") If ($bSuccess <> True) Then ConsoleWrite($oCsv.LastErrorText & @CRLF) EndIf |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.