If date is today then

Hi,

if date is today means i want to select number of 10 in excel sheet .
is it possible?
could anyone help me plz…

You mean you want to select 10 columns because of today’s date is 10 ??

int dayNum = DateTime.Now.Day //will return 10 (10-Dec-2019)

1 Like

Thanks @KarthikByggari,

particularly select 10 th column only,
because that is today’s date.

@Abubakkar,

Do you have the header as date? Then using read column with that date.

2 Likes

Then, get the day number as said in the previous post.
Then convert day number into a equivalent column name.
In this case, columnName - J
Then use Read Range or select range activity with a range "J:J"

Regards,
Karthik Byggari

3 Likes

No, Don’t have header of date

@Abubakkar

Is it okay to assume that considering the month to be December, there could be columns from 1 1 to 31? In which case, the headers shall be static in the cells, B1, C1, D1, and so on.

Please confirm if this is the case?

2 Likes

yes @hacky,
Exactly same

I got this error

image

just I try to read the column name of today’s date is 10

@Abubakkar,

Try like the following by converting the current date to excel column name.
Untitled

1 Like

How to read this column name?
column name is 10
today’s date

@Abubakkar

Thats perfect!!!

ITS VERY EASY!!

  1. So just read the entire sheet (using Read Range and Add Headers property to be checked) into variable - dtReadRaange

  2. Use filter data table Activity go to “Output Columns” tab,

  3. Select “Keep” and write this → Now.ToString(“dd”)

  4. You can give the input datatable (dtReadRange) and output datatable (dtReadRangeNew)

  5. Now, you have the entire column of the todays date day in the datatable (dtReadRangeNew)

Please mark the answer as “Solution” if you found it useful.

Regards,
@hacky

1 Like

Thanks @hacky

but I can’t read column name. frequently get this error

@Abubakkar

Please try using the the Read range activity (Workbook) and check.

1 Like

getting same error

@Abubakkar

Try to perform the testing Unit-by-unit to check where exactly is this issue coming.

I dont really think this error is related to Read range

1 Like

@Abubakkar,

Try to kill all the excel instances from Task Manager then check again.

Refer this post for the same issue,

1 Like

Thanks @sarathi125 @hacky @KarthikByggari

it’s working fine now.

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