[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Creating an Excel input file from an SQR?



I support financials, and I discovered my users were cutting and pasting
most of their SQR reports into spreadsheets, rather than using the hard-copy
output we were sending them.

I've begun giving them their report data in .txt files, using a semi-colon
as a field delimiter (a brief example is shown below).  My users are
delighted, but I think this is still too clumsy.

I want to actually write a file out in Excel format (like the PS Query tool
does it, passing along the column heading row).

I would appreciate any information about accomplishing this, or suggestions
as to where this might be documented.

Thanks.

Betty
Univ of WI - Whitewater

----------------------------------------------------------------------------
--------------------
Example of what I've been doing:

 ! open file and write heading labels in the text file to be loaded to Excel

    Let $Filename4 = 'C:\TEMP\PSTEST\WWSF1098_FOR_EXCEL.TXT

    OPEN $FileName4 as 4 FOR-WRITING RECORD=300:Vary status = #filestat

    Let $Excel_Header = 'Emplid'   || ';'  ||  ! $Emplid
                        '2011'     || ';'  ||  ! Spring amt
                        '2013'     || ';'  ||  ! Summer amt
                        '2017'     || ';'  ||  ! Fall amt
                        'OTHER'    || ';'  ||  ! Other amt
                        'Total'    || ';'      ! sum total
    Write  4  from $Excel_Header


   .... in loop...
 ! Produce the Excel file.

      let #New_Total = #New_2011 + #New_2013 + #New_2017 + #New_OTHER
      let $New_2011   = edit(#New_2011,'9999999.99')
      let $New_2013   = edit(#New_2013,'9999999.99')
      let $New_2017   = edit(#New_2017,'9999999.99')
      let $New_OTHER  = edit(#New_OTHER,'9999999.99')
      let $New_Total  = edit(#Total,'9999999.99')

      let $Excel_Record =    $Emplid    || ';'  ||  ! $Emplid
                             $Old_2011  || ';'  ||  ! Spring amt
                             $New_2013  || ';'  ||  ! Summer amt
                             $New_2017  || ';'  ||  ! Fall amt
                             $New_OTHER || ';'  ||  ! Other amt
                             $New_Total || ';'      !   sum total

      WRITE  4  from   $Excel_Record