The invention relates to a method and device for controlling a groove of a workpiece cut by a robot in offline generation robot data codes. The method mainly includes the steps that a two-dimensional graphic design file is read in CAD and groove features are set for the workpiece in the file; a workpiece graph file with the set groove features is opened, a pre-established or existing robot model and a selected robot path are used for calculating joint variables of all joints, corresponding to all points of the path, of the robot, and the corresponding robot offline data codes are generated according to the variables; the generated robot offline data codes are transmitted to a controller of the robot, so that the robot is controlled to cut the groove of the board workpiece. Through the design of the tail end coordinate position and the posture of the robot and research and development of a robot moving track algorithm, servo drive of the robot is controlled, so that the robot reaches the assigned space target, the assigned position and the assigned posture, workpiece groove cutting is finished, and a traditional undeveloped work mode that the robot is controlled to act depending on manual visual inspection and teaching programming is changed.