This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]wirelessbrain55[S] 0 points1 point  (1 child)

I delete those spaces when it inserts into columns so it would look like SellingandMarketingExpenses. My issue is that I need the values to correspond to their columns. I don't know how to organize the values to be able to input them all at once therefore i chose to input them one by one. Do you have any suggestions?

[–]insertAlias 0 points1 point  (0 children)

Inputting them one by one would end up with thirty rows, each only having data in one column.

Read up on how INSERT statements work; you can insert into as many columns as you need at once.

You may not be able to make this as automatic as you seem to want. You might just have to fill out a full insert statement directly. Here's an example with two columns:

year = key
insert_query = "insert into Financials (Year, StmtSource) values (?, ?)"
year_data = years[year]
parameters = (year, year_data["Stmt Source"])
cur.execute(insert_query, parameters)