How to create a post based on data in a table?

yes that’s possible, you can create your custom post type and use MySQL query to fetch from csv file, and use insert into post function within the loop. you can use LOAD DATA INFILE query to fetch from excel and then use wp insert post function to insert into db.
the query will look like:-

LOAD DATA LOCAL INFILE 'abc.csv' INTO TABLE abc
FIELDS TERMINATED BY ',' 
ENCLOSED BY '"' 
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES
(col1, col2, col3, col4, col5...);