We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
from openpyxl import Workbook # Define column names COLUMN_NAMES = ['College Name', 'Call Letter', 'Email', 'Phone', 'State'] # Define data data = [ ['College A', 'ABC', 'collegea@example.com', '1234567890', 'State A'], ['College B', 'DEF', 'collegeb@example.com', '9876543210', 'State B'], ['College C', 'GHI', 'collegec@example.com', '4567890123', 'State C'] ] # Create a new workbook workbook = Workbook() # Select the active sheet sheet = workbook.active # Set column names for col_num, column_name in enumerate(COLUMN_NAMES, 1): cell = sheet.cell(row=1, column=col_num) cell.value = column_name # Set data for row_num, row_data in enumerate(data, 2): for col_num, cell_value in enumerate(row_data, 1): cell = sheet.cell(row=row_num, column=col_num) cell.value = cell_value # Save the workbook workbook.save('college_data.xlsx')
The text was updated successfully, but these errors were encountered:
what is your problem?
Sorry, something went wrong.
No branches or pull requests
from openpyxl import Workbook # Define column names COLUMN_NAMES = ['College Name', 'Call Letter', 'Email', 'Phone', 'State'] # Define data data = [ ['College A', 'ABC', 'collegea@example.com', '1234567890', 'State A'], ['College B', 'DEF', 'collegeb@example.com', '9876543210', 'State B'], ['College C', 'GHI', 'collegec@example.com', '4567890123', 'State C'] ] # Create a new workbook workbook = Workbook() # Select the active sheet sheet = workbook.active # Set column names for col_num, column_name in enumerate(COLUMN_NAMES, 1): cell = sheet.cell(row=1, column=col_num) cell.value = column_name # Set data for row_num, row_data in enumerate(data, 2): for col_num, cell_value in enumerate(row_data, 1): cell = sheet.cell(row=row_num, column=col_num) cell.value = cell_value # Save the workbook workbook.save('college_data.xlsx')
The text was updated successfully, but these errors were encountered: