CSV Import

I’m try to create an agent to import a rather large CSV file roughly about 300,000 docs. I originally wrote the agent to import a much smaller file. I’ve changed the cells to = 300000, But I get an overflow error Here is my agent…

Sub Initialize

Dim session As New notessession

Dim db As notesdatabase

Dim doc As notesdocument

Dim fileNum As Long, cells As Integer, k As Integer

Dim fileName As String

Dim InputStr As String, delimiter As String

Dim FieldArray As Variant



fileNum = Freefile()

fileName$ = "c:\Test.csv" ' Location of your file

delimiter = "," ' Delimiter of your file

cells = 300000' How many cells + 1

k = 0 



Open fileName$ For Input As fileNum

Do While Not Eof(fileNum)

	Line Input #1,  InputStr$ 

	FieldArray = parseall(InputStr$, delimiter, cells)

	response% = CreateDocument(FieldArray)

	k = k + 1

	Print "Document Created: " + Cstr(k)

Loop

Close fileNum

End Sub

Any help??? Thanks you in advance for any assistance…

Subject: CSV Import

You’ve defined cells & k as Integer. These should be defined as Long because the maximum value for an integer is 32767.

But why re-invent the wheel! We have a free Lotus Notes/Domino import utililty which supports importing from CSV, MS-Excel and other character delimited files.

It comes with full help information, source code, developer comments and is fully supported.

You can download it from:

Regards,

Alex