How to entre 1 st date of every month in different columns of same row in Excel file using UiPath studio coding.
Hi @raghav.bhardwaj.external ,
Could you let us know if you want to create a Excel sheet where you would want the headers/Column Names containing all the first dates of every month ?
Or is there a Excel sheet already prepared or created and you would want to append this data to it, In this case we would also need to know it’s format or a Screenshot of it.
Hello @raghav.bhardwaj.external
Could you please elaborate on your requirement?
For 1st date of the month try this
DateSerial(Year,Month,1).tostring(""dd-MM-yyyy)
Year- Mention the required year
Month- Mention the required month
How to entre 1 st date of every month in different columns of same row in Excel file using UiPath [studio] coding. which acitvites should i use for this code? for sample i am attaching the image i have filed for jan & feb month and now i want to fill for rest of months in columns - H, I,J, K,L M N O & P for all 12 months
Maybe you could try using a combination of Datatable
, For Each
Activities.
-
Use
Build Datatable
Activity with empty columns to create an Empty Datatable. Assign the output Value asDT
. -
Next, Use the Below Expression in the
For Each
Activity and add the generated date values as Column names to the DatatableDT
using anAdd Data Column
Activity.
Enumerable.Range(0,12).Select(Function(x)"'"+(New DateTime(Now.Year,1,1)).AddMonths(x).ToString("M/d/yyyy"))
- Next, Use an
Add Data Row
Activity and add an empty row for the DatatableDT
by using the below expression in theArray Row
Property.
{""}
- Then, we Write the Datatable
DT
to the Excel sheet and specify the range as well starting fromF1
as seen from your example.
The Whole workflow view is provided below :
Let us know if you were able to implement this or are facing any issues.