Skip to main content
Solved

How to read excel headers with spaces

  • December 11, 2025
  • 5 replies
  • 33 views

Forum|alt.badge.img+1

I am trying to read data from an Excel file, but the header names contain spaces. What is the correct way to access these headers in Automation Anywhere without getting errors?

Best answer by Aaron.Gleason

@Laxshmi1242 Make sure to add the quotes. It’s ALWAYS best to use the (x) to insert the variable rather than typing them in. That would have avoided this issue.

$ExcelRow{“Activity Description2”}$

5 replies

Aaron.Gleason
Automation Anywhere Team
Forum|alt.badge.img+14
  • Automation Anywhere Team
  • December 11, 2025

@Laxshmi1242 Headers with spaces work fine. Let’s see your code to see how you’re doing it.

Normally, you use a Loop … through each row of an Excel file. Then, assign that row to a Record variable.

Values from the Record variable (let’s say $rExcelRow$) are accessed using braces and quotes:

$rExcelRow{“My heading with spaces”}$


Forum|alt.badge.img+1
  • Author
  • Cadet | Tier 2
  • December 11, 2025

 


Aaron.Gleason
Automation Anywhere Team
Forum|alt.badge.img+14
  • Automation Anywhere Team
  • Answer
  • December 11, 2025

@Laxshmi1242 Make sure to add the quotes. It’s ALWAYS best to use the (x) to insert the variable rather than typing them in. That would have avoided this issue.

$ExcelRow{“Activity Description2”}$


Forum|alt.badge.img+1
  • Author
  • Cadet | Tier 2
  • December 11, 2025

As shown in the screenshot, the system is clearly indicating that spaces in the header name are not allowed.


Aaron.Gleason
Automation Anywhere Team
Forum|alt.badge.img+14
  • Automation Anywhere Team
  • December 11, 2025

As shown in the screenshot, the system is clearly indicating that spaces in the header name are not allowed.

What the system is showing is that $ExcelRow{Activity is not a valid variable and that Description2}$ isn’t a valid variable either. Because you missed the quotes around the header name, it sees this as two malformed variables.