Export report to excel

G

Guest

I would like to export a report to excel which leaves a blank row in the
excel spreadsheet after each transaction detail line. Can this be done?
 
G

Guest

hi,
more that likely it can be done. but with the sketchy info
you have profided, i wouldn't begin to know how.
 
G

Guest

Sorry,
I just have a simple report which looks as follows:

ProductCode ProductName QuotedPrice
123 xxxxxxx 34.88
234 xxxxxxx 45.78

I would like to export this report excel, but have a blank row create after
each record. For example the spreadsheet in excel should look like:

RowNO. ProductCode ProductName QuotedPrice
1. 123 xxxxxxx
34.88
2.
3. 234 xxxxxxx
45.78
4.
 
J

Jamie Collins

Rosz said:
I just have a simple report which looks as follows:

ProductCode ProductName QuotedPrice
123 xxxxxxx 34.88
234 xxxxxxx 45.78

I would like to export this report excel, but have a blank row create after
each record. For example the spreadsheet in excel should look like:

RowNO. ProductCode ProductName QuotedPrice
1. 123 xxxxxxx 34.88
2.
3. 234 xxxxxxx 45.78
4.

Assuming you have a unique key (e.g. ProductCode), one way of
achieving a row ID is to use a subquery to do the count so far. Then
UNION with the same query but which returns nulls for each column,
adjust the counts accordingly and order on the row ID column.
Something like:

SELECT
(
SELECT
(COUNT(T2.ProductCode)*2)-1
FROM
MyTable T2
WHERE
T2.ProductCode<=T1.ProductCode
) AS rowNO, T1.ProductCode,
T1.ProductName, T1.QuotedPrice
FROM
MyTable T1
UNION ALL
SELECT
(
SELECT
COUNT(T2.ProductCode)*2
FROM
MyTable T2
WHERE
T2.ProductCode<=T1.ProductCode
) AS rowNO, NULL AS ProductCode,
NULL AS ProductName, NULL AS QuotedPrice
FROM
MyTable T1
ORDER BY 1
;

Jamie.

--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top