Save-CSV-File
Command Description
Save CSV File
Command Prototype
CSV.Save(objData,sPath,optionArgs)
Parameter Description
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
objData | True | expression | objData | The data table object to be saved. Can be the data table object opened with CSV.Open, or the data table object returned by the database (the field name will be written as the first row) |
sPath | True | path | '''C:\Users''' | To save the CSV file to the path: If an empty string is passed, then the file will be saved to the original path, otherwise it will be saved to a new location. If the data table is not opened with CSV.Open and the attribute is filled with an empty string, an error will occur |
encoding | None | enum | "gbk" | File encoding. Use ANSI encoding when "ansi" is passed. Use utf-8 encoding when "utf8" is passed. Use utf-16 encoding when "unicode" is passed and use utf-8-sig encoding when "UTF-8 with BOM" is passed |
Demo
/************************************Save CSV file************ ************************
Command prototype:
CSV.Save(objData,'''C:\Users''',{"encoding": "gbk"})
Input parameters:
objData--Data table object to be saved
sPath--the path to save the CSV file to
encoding--file character set encoding (optional)
Outgoing parameters:
None
********************************************************************************/
Dim objData= [["name","age"],["Bieber","27"]]
Dim sPath='''C:\Users\Chance\Desktop\testData.csv'''
CSV.Save(objData, sPath,{"encoding": "gbk"})