Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #3637 > unrolled thread

Reading a spreadsheet

Started byMartin <spam@spam.spam>
First post2012-06-20 09:06 +0100
Last post2012-06-21 07:49 +0200
Articles 4 — 3 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  Reading a spreadsheet Martin <spam@spam.spam> - 2012-06-20 09:06 +0100
    Re: Reading a spreadsheet John Martens <adsl672100@tiscali.nl> - 2012-06-20 12:15 +0200
      Re: Reading a spreadsheet Martin <spam@spam.spam> - 2012-06-20 16:03 +0100
    Re: Reading a spreadsheet "Francesco F." <francescangeli.f.remove@remove.gmail.com> - 2012-06-21 07:49 +0200

#3637 — Reading a spreadsheet

FromMartin <spam@spam.spam>
Date2012-06-20 09:06 +0100
SubjectReading a spreadsheet
Message-ID<twfEr.165677$B64.54831@fx26.am4>
Hello

How easy is it to read the data out of a spreadsheet using VO?

I can handle CSV trivially but want to see if I can avoid them having to 
save as CSV in the spread sheet programme.

Thanks

Martin

[toc] | [next] | [standalone]


#3639

FromJohn Martens <adsl672100@tiscali.nl>
Date2012-06-20 12:15 +0200
Message-ID<4fe1a29e$0$14713$5fc3050@news.tiscali.nl>
In reply to#3637
plain VO can read from regular XLS

it look something like this:

Get the connection
SELF:oHost := SQLConnection{}
SELF:oHost:AccessMode := SQL_MODE_READ_ONLY
cConnect := "Driver=Microsoft Excel Driver (*.xls);Dbq="+SELF:cFileNm
lResult := SELF:oHost:DriverConnect(, SQL_DRIVER_COMPLETE_REQUIRED, 
cConnect)

Read the data
SELF:oSqlSelect := SQLSelect{"SELECT * FROM [CALLS$]",SELF:oHost}

Get the data
SELF:oSqlSelect:FIELDGET(4)

Skip to next line
SELF:oSqlSelect:Skip(1)


Cheers,
John



Op 20-6-2012 10:06, Martin schreef:
> Hello
>
> How easy is it to read the data out of a spreadsheet using VO?
>
> I can handle CSV trivially but want to see if I can avoid them having to
> save as CSV in the spread sheet programme.
>
> Thanks
>
> Martin

[toc] | [prev] | [next] | [standalone]


#3642

FromMartin <spam@spam.spam>
Date2012-06-20 16:03 +0100
Message-ID<EClEr.181069$2H1.27217@fx15.am4>
In reply to#3639
Thanks - I'll try this

Currently copy & paste works as does CSV import

I'll try this later

On 20/06/2012 11:15, John Martens wrote:
> plain VO can read from regular XLS
>
> it look something like this:
>
> Get the connection
> SELF:oHost := SQLConnection{}
> SELF:oHost:AccessMode := SQL_MODE_READ_ONLY
> cConnect := "Driver=Microsoft Excel Driver (*.xls);Dbq="+SELF:cFileNm
> lResult := SELF:oHost:DriverConnect(, SQL_DRIVER_COMPLETE_REQUIRED,
> cConnect)
>
> Read the data
> SELF:oSqlSelect := SQLSelect{"SELECT * FROM [CALLS$]",SELF:oHost}
>
> Get the data
> SELF:oSqlSelect:FIELDGET(4)
>
> Skip to next line
> SELF:oSqlSelect:Skip(1)
>
>
> Cheers,
> John
>
>
>
> Op 20-6-2012 10:06, Martin schreef:
>> Hello
>>
>> How easy is it to read the data out of a spreadsheet using VO?
>>
>> I can handle CSV trivially but want to see if I can avoid them having to
>> save as CSV in the spread sheet programme.
>>
>> Thanks
>>
>> Martin
>

[toc] | [prev] | [next] | [standalone]


#3646

From"Francesco F." <francescangeli.f.remove@remove.gmail.com>
Date2012-06-21 07:49 +0200
Message-ID<jruclg$icl$1@news.albasani.net>
In reply to#3637
Hi Martin,
I keep using the traditional way: extract with automation server the 
necessaries classes from installed Excel, then:

LOCAL oExcelApp  AS OBJECT
LOCAL oRange     AS OBJECT
LOCAL oWorkBooks AS OBJECT
LOCAL oWorkBook AS OBJECT
LOCAL oWorksheet AS OBJECT
LOCAL oWorksheets AS OBJECT
LOCAL cSum AS REAL8

oExcelApp := _Application{"Excel.Application"}
oExcelApp:Visible := FALSE
oWorkbooks := oExcelApp:Workbooks
oWorkbooks:Open("SomeExcelFileWithCompletePath.xls")
oWorkbook := oWorkbooks:[Item, 1]
oWorksheets := oExcelApp:WorkSheets
oWorksheet := oWorkSheets:[Item, 1]
oWorksheet:Activate()

oRange := oWorksheet:[Range,"B26","B26"]
oRange:SELECT()
cSum := oRange:Value

oWorkbooks:Close(TRUE)
XLQuit()

If you need a ready MEF with classes I can send it by PM.

HTH,
Francesco


Il 20/06/2012 10:06, Martin ha scritto:
> Hello
>
> How easy is it to read the data out of a spreadsheet using VO?
>
> I can handle CSV trivially but want to see if I can avoid them having to
> save as CSV in the spread sheet programme.
>
> Thanks
>
> Martin

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web