2012-04-04 111 views
5

我已经为一个CSV文件定义了一个schema.ini文件,但是我有多个CSV,我希望将它们作为序列使用相同的定义。单个schema.ini定义是否可以涵盖多个文件

File0.csv 
File1.csv 
File2.csv 
File.etc.csv 

我的模式将是这样的:

[File*.csv] 
Format=Delimited(,) 
ColNameHeader=True 
col1="Brand Code" Text 
col2=Description Text 
col3="Display Sequence" Text 
+0

文件名这会出现上述*想法不起作用,有没有人有更好的建议? – 2012-04-04 15:16:08

回答

5

据我所知,这是不可能

- * ** * **** 其实它是posibl e,你可以这样做。

[file1.csv] 
FORMAT = Delimited(#) 
ColNameHeader = True 
MaxScanRows=10 
Col1=... 
Col2=... 
ColN=... 

[File2.csv] 
FORMAT = Delimited(#) 
ColNameHeader = True 
MaxScanRows=10 
Col1=... 
Col2=... 
ColN=... 

问候!

0

您可以根据想要上传的文件格式在模块/子例程中定义和写入模式。该模块/子例程必须运行/调用创建模式运行上传前.. (我的样品是用VB6)

注: - Filenametxt是要被上传

IntFileHandleLog = FreeFile 
Open App.Path & "schema.ini" For Output As #IntFileHandleLog 
Print #IntFileHandleLog, "[" & FileNameTxt & "]" 
Print #IntFileHandleLog, "Format=FixedLength" 
Print #IntFileHandleLog, "MaxScanRows = 0" 
Print #IntFileHandleLog, "CharacterSet = OEM" 
Print #IntFileHandleLog, "Col1=" & """" & "Name" & """" & "Text Width 20" 
Print #IntFileHandleLog, "Col2=" & """" & "PHONE_NUM" & """" & " Text Width 30" 
Print #IntFileHandleLog, "Col3=" & """" & "PHONE_TYPE" & """" & " Text Width 20" 
Print #IntFileHandleLog, "col4=" & """" & "UserName" & """" & " Text Width 20" 
Print #IntFileHandleLog, "col5=" & """" & "A_STAT" & """" & " Text Width 10" 
Print #IntFileHandleLog, "col6=" & """" & "B_STAT" & """" & " Text Width 10" 
Print #IntFileHandleLog, "col7=" & """" & "RETRY" & """" & "integer width 2" 
Print #IntFileHandleLog, "col8=" & """" & "Birth_Date" & """" & " double width 14" 
Print #IntFileHandleLog, "Col9=" & """" & "Joint_Date" & """" & " double width 14" 
Close #IntFileHandleLog 
相关问题