I want to sort (to make a table) my data's from a csv-file. Now I have a template with the same thing I want to make, but with the openpyxl-library instead of the csv-library, which I use. In the openpyxl-library you can use ".cell" to speak to only to one cell. How can I do this with csv? Example with openpyxl
This is my current code for csv (file is the variable for my file, and .cell doesn't works):
csvreader = csv.reader(file)
column = []
column = next(csvreader)
for x in range(1, csvreader.line_num+1):
name = csvreader.delimiter(1, x).value
sqltype = ("INTEGER" if type(csvreader.delimiter(2, x).value) == int else "NVARCHAR(255)")
print(f'"{name}" {sqltype},')
there is no cells in CSV so what you can do is loop through the file line by line.
so your code will look like:
for 2. now you have an array that has each value of the CSV, and the "cell" will be the array value so splitterLine[5] would be cell 6.
if you include the code any code that you started I could help you out more.