I have a workbook with multiple sheets in it, and I want to read data from each sheet. I want to append all sheets data to create one big DataTable for easier process.
However, the workbook is poorly organized, and each sheet contain some different columns. Some sheets contain more columns than other sheets.
I don’t need to worry about those inconsistent columns, and I only need to retrieve columns that are common to all sheets. The column orders are also slightly different depending on the sheet, so I cannot use actual range for Read Range.
There are about 7-8 columns that I need to retrieve row data from, and I know the names of these columns.
Is there any way to retrieve data only from specified columns, instead of range? How should I go about this?
Fine no worries buddy @tomato25
–use excel application scope and pass the input as file path and get the out as workbook with a variable named out_workbook
–use a assign Activity within this Excel application scope and mention like this
Out_sheet_list = out_workbook.GetSheets
–here comes the answer for your query create use Build datatable Activity and create the columns you need…get the output as finaldt
–then use a for each loop and pass the input as out_sheet_list and change the type argument as string
–inside the for each loop use a read range activity and mention the sheet name as item and get the output as outdt
–use a for each row loop next to this read range activity while still being inside the first for each loop, and pass the input as outdt
–inside the for each row loop now use a add datarow Activity and mention the input as finaldt in datatable property and in array row property mention only the columnname you want like this {row(“YourColumnName 1”).ToString,row(“YourColumnName 2”).ToString,…}
–so this will add only the column value you want rather to than everyone…
Now you can use this finaldt datatable as you want…hope this would help you
Cheers @tomato25
You could use the filter datatable activity after each read. You can specifiy what columns you wish to keep and as you know the names it should be pretty simple