Activities regarding the removal of space in the column header after extracting from data base

I have extracted the excel from database where I do not need space inside the column headers.How to remove the columns inside space from the column header.

Hi @sowjanya.s

  1. Excel Application Scope:

    • Input: Path to your Excel file
  2. Read Range:

    • Input: “Sheet1” (or the name of the sheet containing your data)
    • Output: dt (DataTable)
  3. For Each:

    • Type Argument: currentItem
    • Values: dt.Columns
  4. Assign:

    • To: currentItem.ColumnName
    • Value: currentItem.ColumnName.Replace(" ", “”)
  5. Write Range:

    • Input: “Sheet1” (or the name of the sheet where you want to write the modified data)
    • Range: “A1” (or the desired starting cell)
    • DataTable: dtExcelData

Hope it helps!!

Will check on it.


One of many options

  • read in the excel - read range with headers - dt1
  • For each Activity | item in dt1.Columns | TypeArgument: DataColumn
    • Assign activtiy: item.ColumnName = item.ColumnName.Replace(" ","")
  • Write range with headers - dt1

Hi @sowjanya.s

Use for each to iterate through columns and use replace method to remove the extra spaces.

YourVariable .Split({Environment.NewLine,vbcrlf,vblf,” ",vbtab,vbcr,vbNewLine},StringSplitOptions.RemoveEmptyEntries)