Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

It is often useful to read data directly from an Excel file rather than having to create additional data files. Using this technique you can read a specific worksheet and/or range to locate just the data you need.

The model for this example is 005 Read from an Excel file. The Excel file (Sales.xlsx) is also provided with sample data

Step-by-step guide

  1. Add a file collector to your model and configure it as follows:

    1. Source Type = Specified Directory
    2.  File Type = Excel Spreadsheet
    3. File Location Strategy  = All files in folder
    4. Input Directory Expr. = The folder name containing your Excel file , within the Import Directory defined in System Directories
    5. File Pattern Expression = ".*.xlsx" (This will ensure only Excel files are processed)
    6. Number of Header Lines = 1. This will ensure the header row doesn't get processed as data and that the attributes are named correctly to match the header row.
  2. Save the changes and then click on the advanced tab

  3. Enter the name of the Worksheet and the range of the data into the Excel data Expression box in the format show below. Include the header row in the range and a number of rows that is sufficient to capture all data

  4. Tick the Ignore Undefined Values box. This will ensure blank rows are ignored
  5. Save changes and Click on the File Columns tab
  6. Click Create the file attributes automatically button. This will populate the attributes as shown below.
  7. Check the data types and lengths and make any adjustments if needed to match the expected data
  8. Save and close the file collector
  9. Hover over the file collector and click Create a new stream using the attributes from the file collector
  10. After creating the stream, view the attributes to confirm they match the file collector
  11. Run analysis on the stream ad view the data from the specified range and workbook, excluding any blank rows

 

 File Collector Configuration

Image Added

 

Image Removed

...

Excel  Worksheet and Range Configuration

Image Added

 

File Column Configuration

Image Added

Sample Workbook setup

Image Added

 

Results after running analysis

 

Image Added 

 

 

 

 

Info

Filter by label (Content by label)
showLabelsfalse
max5
spacesHELP71
showSpacefalse
sortmodified
reversetrue
typepage
cqllabel = "kb-how-to-article" and type = "page" and space = "HELP71"
labelskb-how-to-article

...