
Announcements
Hello,
I have a spreadsheet that contains a list of employee information below, as shown in the example below. How do I append daily data to the list of employees where I want a status count every day? A new column would be added every day in excel for all the employees. I have a total of 10 employees I need to get daily information for.
| Employee Name | 3/6/2023 Count | 3/7/2023 |
| Jane Doe | 1 | 0 |
| John Smith | 2 | 0 |
Hi @MCubedMama ,
Please find the below solution.
Code:
Excel.LaunchExcel.LaunchAndOpenUnderExistingProcess Path: $'''C:\\Users\\vr79540\\OneDrive - Cyient Ltd\\Desktop\\Power Automate Desktop\\Practice\\Vehicle Reg\\Input.xlsx''' Visible: True ReadOnly: False Instance=> ExcelInstance
Excel.ReadFromExcel.ReadAllCells Instance: ExcelInstance ReadAsText: False FirstLineIsHeader: True RangeValue=> ExcelData
Excel.GetFirstFreeColumnRow Instance: ExcelInstance FirstFreeColumn=> FirstFreeColumn FirstFreeRow=> FirstFreeRow
DateTime.GetCurrentDateTime.Local DateTimeFormat: DateTime.DateTimeFormat.DateOnly CurrentDateTime=> CurrentDateTime
Text.ConvertDateTimeToText.FromCustomDateTime DateTime: CurrentDateTime CustomFormat: $'''dd-MMM-yyyy''' Result=> CurrentDateTime
SET RowCount TO 2
SET Counter TO 1
Excel.WriteToExcel.WriteCell Instance: ExcelInstance Value: CurrentDateTime Column: FirstFreeColumn Row: 1
LOOP FOREACH CurrentItem IN ExcelData
Excel.WriteToExcel.WriteCell Instance: ExcelInstance Value: Counter Column: FirstFreeColumn Row: RowCount
Variables.IncreaseVariable Value: RowCount IncrementValue: 1
Variables.IncreaseVariable Value: Counter IncrementValue: 1
END
Excel.ResizeColumnsOrRows.AutofitAllColumns Instance: ExcelInstance
Excel.CloseExcel.CloseAndSave Instance: ExcelInstance
Note: if it worked mark it as a solution