讀檔案:
function readtextintoexcel(path as string)
rowindex = 11
open path for input as #1 '
do while not eof(1) '
line input #1, currline
rowdataarr = split(currline, chr(9))』各資料之前以tab隔開的csv檔案
for i = 0 to ubound(rowdataarr)
cells(rowindex, i + 3) = rowdataarr(i)
next i
rowindex = rowindex + 1
loop
close #1
exit function
end function
寫檔案:
function writeinfointotxtfile(fullpath as string)
rowindex = 11
open fullpath for output as #1
do while sheet1.cells(rowindex, 3) <> ""
print #1, sheet1.cells(rowindex, 3) & chr(9) & _
sheet1.cells(rowindex, 4) & chr(9) & _
sheet1.cells(rowindex, 5) & chr(9) & _
sheet1.cells(rowindex, 6) & chr(9) & _
sheet1.cells(rowindex, 7) & chr(9) & _
sheet1.cells(rowindex, 8)
rowindex = rowindex + 1
loop
close #1
end function
Python讀檔案 寫檔案
讀檔案 在相應的資料夾下建立乙個list.txt檔案。建立乙個包含檔案各行內容的列表 將要讀取的檔案的名稱儲存在變數filename中 filename list.txt with open filename as file obj 呼叫open 將乙個表示檔案及其內容的物件儲存到了變數file o...
java讀檔案,寫檔案的通用方法
在讀檔案和寫檔案的時候用到比較多的為 file,fileinputstream,filereader,inputstreamreader,bufferedreader 在此先介紹上面幾個常用的類 1.file類 很明顯,給乙個位址,就可以構造乙個file物件 file file new file d...
python 檔案操作,讀檔案,寫檔案
讀取檔案的全部內容 def get f none try f open 致橡樹.txt r encoding utf 8 print f.read except filenotfounderror print 無法開啟指定的檔案 except lookuperror print 指定了未知的編碼 e...