X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 88EB03A4002 for ; Tue, 9 Nov 2004 22:49:19 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 06004-03 for ; Tue, 9 Nov 2004 22:49:15 +0000 (GMT) Received: from mailhub1.otago.ac.nz (mailhub1.otago.ac.nz [139.80.64.218]) by svr1.postgresql.org (Postfix) with ESMTP id 0F9CD3A3FFC for ; Tue, 9 Nov 2004 22:49:14 +0000 (GMT) Received: from pooka.otago.ac.nz (pooka.otago.ac.nz [139.80.8.4]) by mailhub1.otago.ac.nz (8.12.11/8.12.11) with ESMTP id iA9MnA3Z012029; Wed, 10 Nov 2004 11:49:11 +1300 Received: from POOKA/SpoolDir by pooka.otago.ac.nz (Mercury 1.43); 10 Nov 104 11:49:11 GMT+1200 Received: from SpoolDir by POOKA (Mercury 1.43); 10 Nov 104 11:49:03 GMT+1200 Received: from PE2612 (139.80.8.36) by pooka.otago.ac.nz (Mercury 1.43) with ESMTP; 10 Nov 104 11:48:54 GMT+1200 From: "Tim Bishop" To: "'Jeff Eckermann'" , "'Merlin Moncure'" , Subject: Re: excel and postgresql: tips and questions Date: Wed, 10 Nov 2004 11:48:55 +1300 MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.5510 In-reply-to: <20041109170542.38615.qmail@web20821.mail.yahoo.com> Thread-Index: AcTGflgh/EigJskZTnuU1xJoCf6H7wAL0eOA X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Message-ID: <1B2042CF7F6F@pooka.otago.ac.nz> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.8 tagged_above=0.0 required=5.0 tests=DOMAIN_BODY X-Spam-Level: * X-Archive-Number: 200411/63 X-Sequence-Number: 4677 > > Alternatively you could try interposing MS Access, i.e. > define your queries in an Access database, and use those > queries as the datasource for the Excel report. I would try using a web query instead of access. Make a simple (password protected!) cgi that executes arbitrary sql and returns a html table. Then use a web query from excel. From recording a macro, I see that you can set the URL to be anything you want (from vb) With ActiveSheet.QueryTables.Add(Connection:= _ "URL;http://www.otago.ac.nz/phonebook/surnamef.html", Destination:=Range( _ "A10")) .Name = "surnamef" .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = False .RefreshOnFileOpen = False .BackgroundQuery = True .RefreshStyle = xlInsertDeleteCells .SavePassword = False .SaveData = True .AdjustColumnWidth = True .RefreshPeriod = 0 .WebSelectionType = xlSpecifiedTables .WebFormatting = xlWebFormattingRTF .WebTables = "6" .WebPreFormattedTextToColumns = True .WebConsecutiveDelimitersAsOne = True .WebSingleBlockTextImport = False .WebDisableDateRecognition = False .WebDisableRedirections = False .Refresh BackgroundQuery:=False End With You should thus be able to pop any parameters or sql you want in the query string. The advantage of this method is that excel handles getting the data into the worksheet. And, you don't need to install Postgres odbc drivers on your deployment machines. I did do this with 2003. I'm not sure if you can do this with earlier Excel versions. -Tim