Thank you, I was able to get this to work for a short list of genes. For my full list of genes, I get this error
Error in getBM(mart = ensembl, attributes = c("ensembl_gene_id", "external_gene_name", :
object 'genes' not found
My guess is because some of the gene names might not be correct "external gene name". Is there a way to filter out those genes, or at least do a quality control check to see if a given gene name is recognized by ensemble?