How i can filter excel with all data current month?

try this DT_Pre_Allegro.Select (“[Price Date] like '%” + Now.ToString (“MM / yyyy”) + “%'”). CopyToDataTable (), but it copies wrong data to me.

@CMNV Can you show us the Format of the date in the DT_Pre_Allergo datatable, So that we can use that format to get the date you want.

To check the format, you can just use a Message box with the value :
DT_Pre_Allergo(0)(“yourDateColumnName”).ToString

1 Like


here an image of the excel data

@CMNV Are there No Column Headers present :sweat_smile:

Did you try with filter data table activity and use contains filter?

Hi!,
Yes, Try with filter data activity, but the filter did not work

Captura de Pantalla 2020-07-27 a la(s) 12.03.25

If the file has a column, but I wanted to show more current data

@CMNV Can you tell me What is the Column Name of Date Column ?

@CMNV Have you Checked this ?

I have tried.Its working… May be format issue with your excel. Try changing the format to text and check once

well, try this :

DT_Pre_Allegro.Rows.Cast(Of DataRow).Where(
Function(x) CDate(x(“Fecha Precio”)).ToString(“yyyy-MM-dd”).Contains( Now.ToString(“yyyy-MM”) )
).CopyToDatatable

1 Like

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