Discontinuation of diabetes medication in the last years of life has been suggested to improve quality of life while deemed safe to implement. However, the extent, patterns, and secular changes in discontinuation of glucose-lowering medication in older people with type 2 diabetes have been scarcely described. We therefore aimed to describe the trends in the use of glucose-lowering medication during the last 10 years of life of older people and explore how key clinical and socioeconomic covariates are associated with these patterns. In this register-based cohort study, all individuals with type 2 diabetes who died aged 80 years or older between Jan 1, 2006, and Dec 31, 2018, were identified through the Danish Diabetes Register and linked to the Danish National Prescription Registry. We followed the population backwards in time from death to date of last medication intake. To estimate the cumulative proportion of people on glucose-lowering medication, a Poisson regression model for the rate of medication as a function of time before death (0 to 10 years before death) and calendar year of death (2006-18) was fitted. Both single-substance and combination glucose-lowering medications were included and categorised as insulins, sulfonylureas, metformin, DPP-4 inhibitors, GLP-1 analogues, SGLT2 inhibitors, acarbose, and thiazolidinediones. Insulin was further subdivided into four groups: fast-acting, intermediate-acting, long-acting, and mixed insulin. To identify which covariates were associated with discontinuation, estimates were adjusted for sex, age at death, diabetes duration at time of death, the total number of diabetes complications at time of death (from no complications to four or more), level of education, immigrant status, and income quartile. 52 523 individuals (28 746 [54·7%] females and 23 777 [45·3%] males) were identified, with a mean age at type 2 diabetes diagnosis of 77 years (SD 8), median age at death of 86 years (IQR 83-90), and median diabetes duration at death of 9 years (IQR 5-14). We found a considerable discontinuation of glucose-lowering medication during the last 10 years of life, with the proportion of people on glucose-lowering medication starting at between 89% (95% CI 87-91) in 2006 and 87% (86-88) in 2018 at 10 years before death and decreasing to between 52% (50-54) in 2006 and 38% (37-39) in 2018 at the time of death. Specifically, we found that the proportion of people on sulfonylureas, at any time before death, decreased substantially from 2006 to 2018, whereas the proportion on metformin and DPP-4 inhibitors increased with calendar year of death. Changes were less pronounced for the remaining medications. The overall discontinuation patterns changed with increasing calendar year of death, such that discontinuation rates increased and occurred earlier (further away from time of death) with increasing calendar year. Discontinuations were generally more pronounced during the last year of life. Proportions of people on medication and patterns of discontinuation, as well as the association with covariates, varied with medication class. Covariates most frequently associated with changes in discontinuation rates were sex, age at death, type 2 diabetes duration at death, and number of complications. For example, females were less likely to receive metformin than males at all years before death (rate ratio 0·91 (95% CI 0·89-0·94, p<0·0001), and there was a negative association between the proportion of individuals on metformin and increasing age at death (rate ratio per year increase 0·96 [0·96-0·96], p<0·0001) and type 2 diabetes duration (0·95 per year increase [0·94-0·95], p<0·0001). Our results suggest that increased focus on and implementation of discontinuation of glucose-lowering medication in recent years might have had an effect on discontinuation patterns, particularly during the last year of life. None.