I have a program that reads a csv file and filters the data in it, then writes a new csv with the filtered data. I need to make this code available and executable within a web browser, but so far the only way I've seen to do it involves some use of JavaScript. I've never tried anything like this so any information to point me in the right direction is much appreciated!! Thanks! Here's a draft of the code if that helps.
readFile = input("--Enter name of file to be read: ")
writeFile = input("--Enter name of file to be written: ")
with open(readFile,'r') as readFile:
print("Reading File...\n")
for eachline in readFile: # converting columns to lists
parts = eachline.strip('\n').split(',')
column1.append(parts[0])
column2.append(parts[1])
del column1[0] # deleting the header of the column
del column2[0]
for i in range(len(column1)): # converting strings to int/float
column1[i] = float(column1[i])
column2[i] = float(column2[i])
########### data filter #####################
with open(writeFile,'w') as writeFile:
print("Writing new file...\n")
for x in range(len(biglist2[1])): # will iterate as many times as there are rows in csv
for y in range(len(biglist2)): # will iterate as many times as there are columns in csv (3)
if y == 2:
writeFile.write(str(biglist2[y][x]))
else:
writeFile.write(str(biglist2[y][x])+',')
writeFile.write('\n')
print("Program Complete!\n")
bruthonbrython.info, but I am not sure how much it is compatible, also you can't simply write to sidk from browser because of permission, you need to handle it ina different way.