引用数据库中的其他表/表

时间:2018-06-20 13:18:58

标签: python excel database csv spreadsheet

我想引用我数据库中名为Questions的{​​{1}}表/工作表

我将在哪里实现参考点,以便仅访问StudentNames工作表

Questions

1 个答案:

答案 0 :(得分:0)

如评论中所述,csv可能不是您尝试执行的最佳格式。如果您已经 具有此信息的excel文件,则可以考虑为excel构建的python库,例如pandas。 The answer to this question引用可以传递给熊猫sheet_name函数的参数(即read_excel),以确保您仅使用特定的工作表。

    import pandas as pd
    def QuestionGenerator():
       questionlist_file = pd.ExcelFile('StudentNames.csv')
       sheet_of_interest = pd.read_excel(questionlist_file, 'Questions')
       ...
相关问题