Monday, November 12, 2007

Export to Excel on Web

We have seen many ways to export the notes view contents onto an Excel Sheet and this is one of the simplest ways of them. It is a 3 step process as explained below:

Step 1:
Create a hidden view on the database with all the columns included which are required for the Excel Export.

Step 2:
Create a new notes form and key in the information following the syntax below:
Line 1: Type of the query
Line 2: Version
Line 3: URL (http://Server_Name/Database/Excel Export View Name)
Line 4: POST parameters


Optionally, you can include the formatting parameters following these 4 lines as shown in the example below.
Eg:
WEB
1
http://SERVER_NAME/DATABASE/ExportToExcel
Selection=AllTables
Formatting=All
PreFormattedTextToColumns=True
ConsecutiveDelimitersAsOne=True
SingleBlockTextImport=True
DisableDateRecognition=True

Save the form as a web query form. (Extension : ".iqy")

For more information on "web query" concept, Click here.

Step 3:
Create a $$ViewTemplate for the export view to preview the view on web. Also, include an action button called "Export to Excel" which has this code beneath:
"Export.iqy?ReadForm"



Preview on web and Excel Export works like a charm!
Screendumps below gives you an idea:

Screen 1: View on web with "Export to Excel" link


Screen 2: On clicking "Export to Excel" link, an excel file opens up with the following message. Click "Open" to proceed.


Screen 3: Excel retrieves data from the database.


Screen 4: Final Report