The args.header.level property stores the row number (starting at 0 for the first row from the top).
You can also use args.header.start and args.header.end to get the duration:
const duration = new DayPilot.Duration(args.header.start, args.header.end);
const days = duration.totalDays();