Excel data containing ' throws error in select method


Continuing the discussion from Quotes Escape Character:

select method

It throws error Syntax error: Missing operand after ‘21’ operator.


Could you see if this will work:
Instead of

I dont find any difference. Both looks same :slight_smile:

Are you allowed to change the month format from jan’21 to jan21

Yes by using regex we can do that but I wanted to get the data as it is.

Here it is :sweat_smile:

It sometimes breaks the syntax, so I wanted to rule it out first.

It is single quote right ?
I have also put single quote but looking different.

1 Like

Correct. I think for some reason the other quote used to give errors, but I tested it myself just now and it was not the issue.

The issue was that you are basically doing this:

currQtrDT.Select("[Month Year]='Jan'21'")

That extra single quote is basically messing up the syntax and the expression doesn’t know what it should consider.

However, this is typically resolved by escaping the character with an identical one. I gave it a try and it worked:

currQtrDT.Select("[Month Year]='Jan''21'")

So for your original expression it would be:


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