Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CSV with double quotes
Message
From
07/03/2017 08:14:26
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
07/03/2017 04:39:27
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01648804
Message ID:
01648822
Views:
50
>never tried for sizes past int2, but you could do a quick test if _vfp.datatoclip(,,3) plus insert/ctrl-v in excel works with your data - perhaps you need to check for tabs in your data first. Automating the insert if ok should be a piece of cake ;-)
>
>

Yes, that is also one of the fastest way to transport data to excel. I wouldn't suggest using datatoclip for that (it creates extra column for example) and here is a sample instead that I published long ago:
clear
Clear All
* Create a test cursor
Create Cursor testcursor (Rcno i,cType c(10), nType i, dType d)
Rand(-1)
For ix = 1 To 200000 && Create 200000 recs cursor
	Insert Into testcursor Values ;
		(Recco()+1,Sys(2015), Int(Rand()*1000), Date()-Int(Rand()*100))
Endfor
lcHeader = Chrtran('Rcno,cType,nType,dType',',',Chr(9))+Chr(13)+Chr(10)

#Define xlDelimited  1
Set Sysformats On
Set Safety Off

lnTotal = Reccount()
locate
Wait Window Nowait "Pls wait sending data to Excel..."
Start = Seconds()
oExcel = Createobject("Excel.application")
With oExcel
	.workbooks.Add && Add a new workbook
	lnMaxRows = .ActiveWorkBook.ActiveSheet.Rows.Count && Get max row count
	lnNeededSheets = Ceiling( lnTotal / (lnMaxRows - 1) ) && 1 row header
	? "Total Pages : "+Padr(lnNeededSheets,3," ")
	.Visible = .T.
	With .ActiveWorkBook
		lnCurrentSheetCount = .sheets.Count
		If lnNeededSheets > lnCurrentSheetCount
			.sheets.Add(,.sheets(lnCurrentSheetCount),;
				lnNeededSheets - lnCurrentSheetCount) && Add new sheets after old ones
		Endif
		For ix = 1 To m.lnNeededSheets
			With .sheets.Item(ix)
				.Name = "Page "+Padl(ix,3,"0")
				.Activate
				lcTempFile = Sys(2015)+".txt"
				Copy Next m.lnMaxRows-1 To (m.lcTempFile) Delimited With Tab 
				_Cliptext = m.lcHeader + Filetostr(m.lcTempFile)
				Erase (lcTempFile)
				.Range("A1").PasteSpecial()
				IF !EOF()
					SKIP
				endif
				? "Page no : "+;
					padl(m.ix,3)+;
					"/"+;
					padr(m.lnNeededSheets,3)+ ;
					"   Elapsed : ",Seconds() - Start
			Endwith
		Endfor
		.sheets.Item(1).Activate
	Endwith
Endwith
? "Total Elapsed : ",Seconds() - Start
I would however suggest using VFP2Excel function.
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform