SQL 2 Excel - Tutorial PDF Print E-mail

sql2excel_icon_transThis tutorial guides you through the steps of creating your first downloadable Workbook using SQL 2 Excel.  A "Hello Word" for SQL 2 Excel!

This tutorial assumes you have already installed SQL 2 Excel - both the the Module as well as the Component.

  1. In Joomla Administrator, select Component > SQL 2 Excel. This takes you to the SQL 2 Excel control panel."

    sql2excel_controlpanel_thumb

    You can install sample data by clicking on the "Add Sample Data" button. But this tutorial will guide you through the whole process from scratch.

  2. SQL 2 Excel supports Sections and Categories. It is the same concept as Joomla uses to classify articles. First define a Section. Click on "Sections" in the SQL 2 Excel control panel. This will show you the list of defined sections.

    sql2excel_sections_thumb

  3. Click on New in the toolbar. This brings up a form where you can specify the name of your Section. We want to create a section called "Demo" so we fill it in like this:

    sql2excel_tutorial_new_section_thumb

    Note: We can control access to the section with two method. One is by by setting the Access level to Public/Registered/Special. The other is by setting it to Published/Unpublished. When it is Unpublished the section will NOT show up in the SQL 2 Excel module in the frontent. Here we set it to Public access and Published.

    Note 2 : Description is only used for your own notes. Not displayed anywhere at the moment.

    Click on Save to save your Section.



  4. Now you should see the Demo section listed in the list of sections, something like this:

    sql2excel_tutorial_new_section_list_thumb

  5. Next, we need a Category. Click on Categories and then on New. It will bring up a similar form where you enter the Category information. Here I define a Category called "My Category" for this tutorial. Setting it to Public access and making it Published directly. You need to select a section for your category. I select our "Demo" section as the parent of this category.

    sql2excel_tutorial_new_category_edit_thumb

  6. Click on Save The category and you should now see your new category in the list of Categories:

    sql2excel_tutorial_category_list_thumb

  7. Next step is to create Worksheets that we wish to be included in our Excel Workbook. Click on Worksheets and then click on New. It brings up a form where you can define the content of a Worksheet. There are several settings in this form, but it's fairly simple to setup.

    General Settings

    sql2excel_tutorial_ws_general

    The Title is only used in the backend. You can use some descriptive name so that you can identify the worksheet.
    The Sheet Name is the name of the Worksheet in the Excel workbook.
    Include no records : If you set this to Yes then the worksheet will be included even when the query returns zero results. YIf you set it to No then the Worksheet is not even included in teh Workbook when no records are found.
    Message no records : Optional message to show on the Worksheet when no records are found.





    Header

    sql2excel_tutorial_ws_header

    Query

    sql2excel_tutorial_ws_query

    This is the key part of the Worksheet setting. It controls what data you output.

    Column Heading Bg Col : The background color of the column headings.
    Column Heading Text Col : The text color of the column headings.
    Column Heading Text Size : The text size of the column headings.
    Col widths : Column widths. Comma delimited list. In this case we define the width of the first three columns of the worksheet. The rest of the columns will be left at default.
    SQL Query : The SQL query that will be executed for this worksheet. Any valid SQL query can be entered here. Use myPHPadmin, or soem other means to debug and test your queries to make sure they are error free.

    Footer

    sql2excel_tutorial_ws_footer

    Similar to the header. This text shows up at the bottom of the Worksheet, below the data output. Please note the use of a line break to create a space between the data and the footer text.

    Click on Save to store your new Worksheet. It should show up in the list of Worksheets like this:

    sql2excel_tutorial_ws_worksheets_thumb

  8. Finally, we define a workbook. Click on Workbooks and then on New. This brings up a form where you define the workbook properties:

    sql2excel_tutorial_wb_edit_thumb

    We specify a Seaction and a Category for the workbook. This allows us to later display specific Workbooks in the SQL 2 Excel Module. You can copy the module and publish it on different pages. Each module can be configured to show Workbooks only from certain Sections and/or categories.

    At the bottom of this form you can select which Worksheets to include in this Workbook.  Select one or more Workbooks by using the green arrows. You can move the selected Worksheets up or down using the up/down arrows to the right. This controls the sheet order in the Workbook. The Worksheet listed on top will be the first Worksheet. In this case we only include one Worksheet so the order is not an issue.

    We select to publish this Workbook with Public access.

    Click on Save.





  9. The Workbook should now show up in the list of defined Workbooks, like this:

    sql2excel_tutorial_wb_list_thumb


  10. We have now defined our first Workbook. It only has one Worksheet. If you want to add more Worksheets, just define the extra worksheets and then edit the Workbook and include as many Worksheets you need. So how do we now publish these Workbooks? This is where the SQL 2 Excel Module comes in. Make sure you have published the module in Module Manager and that you are displaying it on some page(s).

  11. Go to a page on your site where the SQL 2 Excel Module has been published on. It should now show up and list the Workbook that we defined:

    sql2excel_tutorial_module

    The Articles Workbook shows up. Clicking on the link executes the SQL query that we have defined for the Worksheet and delivers an Excel file directly to the browser. This is what the report looks like in OpenOffice Calc:

    sql2excel_tutorial_openoffice


This concludes the first simple "Hello World" tutorial for SQL 2 Excel.


Still unclear about something?

  • Submit a comment/question below

  • Use our Discussion Forum
Comments (7)add comment

Val said:

0
...
Can you tell me two things:

1. How do I shut off the ability to DOWNLOAD and just leave the view.
2. How do I make the results of a field a hyperlink?

Thank you
Val
 
April 24, 2009
Votes: +0

Mats @ Joomla-R-Us said:

admin
...
@Val:

1) Go to SQL 2 Excel Control Panel. Click on "Parameters" button. Set "Show Download Button" = No

2) If a field value starts with http then it will be hyperlinked automatically. For example:

SELECT ID, TITLE, CONCAT('{SERVER_URL}index.php?option=com_content&view=article&id=',ID) AS URL FROM jos_content

See: http://joomla-r-us.com/faq/31-...ion-how-to

If you click on "Add Sample Data" in the SQL 2 Excel Control Panel then you'll get two Worksheets where there's an example on hyperlinks.
 
April 24, 2009
Votes: +3

Mats @ Joomla-R-Us said:

admin
...
@Val:

Another way to do it is to spit out HTML syntax for the link, something like this:

SELECT ID, CONCAT('',TITLE,'') AS Article
FROM jos_content

It will render as a hyperlink in the Preview, but you will see the HTML code in the downloaded spreadsheet.

PS Remove the rel=nofollow. The comment system adds it automatically...
 
April 24, 2009
Votes: +1

Mikey said:

0
...
How do I download the exported file from the back end?
 
October 02, 2009
Votes: +0

Mats @ Joomla-R-Us said:

admin
...
In the backend, create one or more Worksheets. Then create a Workbook, and add your Worksheet(s). You can download the Workbooks in the backend using the "Download" links which are located on the right hand side of the Workbook list in the backend.
 
October 02, 2009
Votes: +0

Mario said:

0
...
How can I use the XLS file "Community_Builder_Users.xml"?

Tks
 
January 25, 2010
Votes: +0

Mats @ Joomla-R-Us said:

admin
...
@Mario: Please see the installation instructions for the sample SQL 2 Excel reports: http://joomla-r-us.com/faq/31-...nstruction
 
January 25, 2010
Votes: +0

Write comment

security image
Write the displayed characters


busy
 
 
  Design by augs-burg.de & go-vista.de  
 
     
 
   
 

The Joomla!(R) name is used under a limited license from Open Source Matters in the United States and other countries. http://Joomla-R-Us.com is not affiliated with or endorsed by Open Source Matters or the Joomla! Project.