This is probably an easy one for most of you, but how do I collate 107 separate .csv file contents (delimited) into one. I am getting 107 files from a SODAR machine (ultrasonic wind measurement device), but want to analyse this in EXCEL so I can do more processing and get useful info out.
I wrote a Visual Basic program in Access (yeah, I know - shoulda not bothered !) and it does spurious stuff like missing some files and screwing up my files (and my brain). Here it is just to show you what I kinda want to do :
Private Sub ImportSodarFiles()
Dim dbsSodar As Database
Dim dbSodar As Recordset
Dim strDate As String
Dim strSearch As String
Set dbsSodar = DBEngine.Workspaces(0).Databases(0)
DoCmd.SetWarnings 0
Set fs = Application.FileSearch
With fs
' .LookIn = "C:\Sodar"
.LookIn = "P:\wind\Sodar\Data"
.FileName = "*.csv"
If .Execute > 0 Then
MsgBox "There were " & .FoundFiles.Count & _
" file(s) found. OK to import"
For i = 1 To .FoundFiles.Count
DoCmd.TransferText acImportDelim, "Sodar", "Sodar", .FoundFiles(i)
Set dbSodar = dbsSodar.OpenRecordset("SELECT * FROM Sodar")
With dbSodar
.MoveLast
.MoveFirst
End With
strDate = dbSodar![Date & Time]
dbSodar.MoveFirst
For a = 1 To dbSodar.RecordCount
With dbSodar
.Edit
![Field29] = strDate
.Update
.MoveNext
End With
Next a
DoCmd.OpenQuery "Cleanup"
DoCmd.OpenQuery "Transfer"
DoCmd.OpenQuery "Purge"
Next i
MsgBox "Finished"
Else
MsgBox "There were no files found."
End If
DoCmd.SetWarnings 1
dbsSodar.Close
End With
End Sub
at the end of all this I end up with separate columns (Date, measurement interval, wind speed, temperature etc).
Is there a php chunk of code I could use instead ?
Thanks for your help,