How to save my output row by row into excel

Below is the output that I saved to Excel after the extraction. But they’re in the same column, how can I save the output in different row? For example in my screenshot, I have 3 lines of string in the same column, I want to separate each line of them and save into different column (row by row).

Hi @Xian

If you want the dat to be shown in different rows try this ,else please give sample inputs and outputs so it would be helpful.

Input

image

Output

image

Updatr.xaml (10.9 KB)

Hi @prasath_S

This is my workflow. My input is extracted from a window by using “Get Full Text” function. And then I use “Assign” function to remove unnecessary words. Then i use “Write Cell” function to save the output into Excel.

@try give strText as variable name for get full text and instead of write cell, please try build datatable, foreach and write range activites.

Thanks

@prasath_S I’m not so clear about the “build data table” function. What should I do to connect the output from “Get Full Text” function with “Build data table” function?

@Xian build datatable is just the schema (structure) we are giving to the datatable like how Many columns and what are the column types.

Please try this steps

  1. Use get full text and extract the value.

  2. Remove unnecessary strings from it.

  3. Use build datatable.(we mention only one column in it)
    It’s output is dt (datatable)

  4. Use for each row as i mentioned in the previous post (also refer the xaml)

  5. Use write range and write the datatable to the excel.

From your screenshot, you don’t need output datatable and write cell and excel application scope.

Thanks

@prasath_S Can you please help me to check why there is an error?


Main.xaml (9.9 KB)

@Xian Please try change the type argument property of for each from object to string.

Thanks

@prasath_S I changed it to string. The error still exist.

@Xian okay its curly braces and not circle one.

It should be {item}

Array should always use inside curly braces.

Thanks

@prasath_S Okay, I have updated that. But what is this error about?

@Xian have you give dt as the output of build datatable?

It is showing null, please give dt in the build datatable output

Thanks

@prasath_S Yes, it works now. But why there is an empty row between them?

image

Please try this in for each,

strText.Split(Environment.NewLine.ToCharArray,StringSplitOptions.RemoveEmptyEntries)

Thanks

@prasath_S Thank you very much! It works correctly now.

1 Like

Glad that it helped…

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.