0% found this document useful (1 vote)
677 views5 pages

Reading Multiple Sheets of A Xls File in Bods

This document describes a design for extracting data from multiple sheets within a single Excel workbook and loading it into a target table. The design uses two dataflows - one to collect the names of all sheets in a control table, and another to extract data from each sheet while looping through the sheet names. Start and end scripts are used to retrieve the next sheet name from the control table, extract data from that sheet, and then delete the sheet name, repeating until all sheets are processed.

Uploaded by

isskumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
677 views5 pages

Reading Multiple Sheets of A Xls File in Bods

This document describes a design for extracting data from multiple sheets within a single Excel workbook and loading it into a target table. The design uses two dataflows - one to collect the names of all sheets in a control table, and another to extract data from each sheet while looping through the sheet names. Start and end scripts are used to retrieve the next sheet name from the control table, extract data from that sheet, and then delete the sheet name, repeating until all sheets are processed.

Uploaded by

isskumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Generated by Jive on 2014-08-14+02:00

1
Data extraction from multiple sheets of excel
work book

Business Requirement: I have a requirement where we will receive an excel workbook comprises of all cost
center information (area wise) sheets in a single excel workbook. We should extract the data of all work sheets
(CC1, CC2, and CC3) and load it in the target table.

We recommended customer to create one more sheet by name SHEET_NAMES in the same workbook and
list all the sheet names as shown below.



Design

I have used 1 WF & 2 DF, 2 script files (Start Script & EndScript) and 1 temporary table which stores sheet
names information.
First Dataflow: Will collects all the sheet names from excel workbook and stores in the Sheetnames table.
2
nd
Dataflow in the workflow: Extracts the data from all the worksheets, maintaining work sheet names in the
control table and assigning sheet names dynamically to global variable will be manipulated in StartScript and
EndScript

The Job comprises of
1. ExtractSheetNames_DF
2. CC_DATA_EXTRACT_WF
3. CC_DATA_EXTRACT_WF/CC_DATA_DF
4. Excel File Formats (CC_SheetNames and CC_DATA_INP)
5. Script Files (StartScript and EndScript)
6. Global Varaiable $GSheetName

The prerequisites are
Data extraction from multiple sheets of excel work book
Generated by Jive on 2014-08-14+02:00
2
1 DB Table with two columns SNo and Sheetnames
During creation of CC_SheetNames excel file format in the Designer, mention Worksheet as
SHEET_NAMES(contains all the sheet names) as specified below


During creation of CC_DATA_INP excel file format in the Designer , mention the Worksheet with
Global variable $GSheetName, the sheet name will be assigned dynamically in the Start Script.



Data extraction from multiple sheets of excel work book
Generated by Jive on 2014-08-14+02:00
3

Design Steps
The below diagram shows the overall job

JOB_DynamicExcelExtraction
Data extraction from multiple sheets of excel work book
Generated by Jive on 2014-08-14+02:00
4


ExtractSheetNames_DF will collect all the sheet names from the work sheet SHEET_NAMES and stores it in
Sheetnames DB table
In the below CC_DATA_EXTRACT_WF place while loop and put a condition that $GSheetName is not equals
to null.



Data extraction from multiple sheets of excel work book
Generated by Jive on 2014-08-14+02:00
5
1. In the StartScript, the first sheet name will be retrieved from Sheetnames table and will be assigned
dynamically to the global variable.
2. The CC_DATA_DF data flow will take the assigned sheet name from the global variable and extract the
appropriate data
3. In the EndScript, the assigned sheet name [from which the data is extracted in the step 2] will be
deleted from Sheetnames table

While loop will execute the above 1,2,3 steps until the data extraction of all the sheets completed.


Start Script code
print(' Sheet Name is after delete in First Script'|| $GSheetName );
$GSheetName = sql('Practice', 'select top 1 SHEET_NAMES from Sheetnames');
print(' Sheet Name is after Selecting top 1 in First Script'|| $GSheetName );

End Script code
print(' Sheet Name is '|| $GSheetName );
sql('Practice', 'delete from Sheetnames where SHEET_NAMES = {$GSheetName}' );
print(' Sheet Name is after delete'|| $GSheetName );
$GSheetName = sql('Practice', 'select top 1 SHEET_NAMES from Sheetnames');

You might also like