By using expertatexcel.com you agree to our cookie policy, We and our partners operate globally and use cookies, for multiple purposes

expertatexcel.com

 


GenerateExcelFiles from a db - udf

🔝
This routine will generate multiple Excel files from a sheet with Query information

Routine
  • append SQL to sheet name
  • delete sheets that were creating
  • ignore requests
  • Set column variable
    • Excel Output
    • SQL File
    • Parm1
    • SQL Name
    • Value1
    • Parm2
    • Value2
    • Datasource
    • SheetName
    • Methodology Sheet
    • VBA Code
    • Glossary Sheet
  • for each row in sheet
    • skip if ; in first char of sqlname
    • Log the step
    • GenerateExcelInputFileGeneric
    • if return is 0


    GenerateExcelInputFileGeneric
  • Set the datasource
  • Check if the excel output exists
  • Check if SQL file exists
  • Open the SQL file
  • Remove SQL Comments
  • Process include
  • Update the Parms $parm1, $parm2
  • Create directories
  • Save the SQL after substitution
  • Clean up the SQL
  • ProcessSQL
  • Save the output to a new workbook
  • Add a Pivot for special case
  • Add Confidential sheet
  • Add Methodology sheet
  • Add Glossary Sheet
  • Run the VBA code if set
  • Remove RangeNames '

  •