CSV Blank Rows Importing

I have a button that imports a csv file into a table

[code]

import csv

path = system.file.openFile(“csv”)

if path != None:

csvData = csv.reader(open(path))
 

header = csvData.next()
 
# Create a dataset with the header and the rest of our CSV.
dataset = system.dataset.toDataSet(header ,list(csvData))



event.source.parent.getComponent('Table4').data = dataset

system.gui.messageBox('Import Complete')[/code]

Once the table is populated from the csv, the user can make changes to the table if needed. When editing is finished, another button loops through the table inserting it into the DB. My problem is that when i save the csv in excel it has an extra 50 rows or so of blank commas at the end.

[code]
TEST0F9-02SKP,RB,5x5,0F9-02SKP 5x5RB,S134-2612,RAIL SUPPORT,CHOP,3,LUMBER,LBR, 7/8,1.75,26.5,OPTIMIZER,12,Storage Ottoman
TEST0F9-02SKP,RB,5x5,0F9-02SKP 5x5RB,P2800-3212,TOP,ROUTER,1,ROUTER CODE 1365 4X8,OSB,0.75,28,32.5,1365,ROUTER,3,1,12,Storage Ottoman
TEST0F9-02SKP,RB,5x5,0F9-02SKP 5x5RB,1365-1,TOP MECH RAIL,ROUTER-TNUT,(2) 1/4 T-NUT L&R,2,ROUTER CODE 1365 4X8,OSB,0.75,CNC,CNC,1365,ROUTER,3,1,12,Storage Ottoman
TEST0F9-02SKP,RB,5x5,0F9-02SKP 5x5RB,1365-2,TOP RAIL,ROUTER,2,ROUTER CODE 1365 4X8,OSB,0.75,CNC,CNC,1365,ROUTER,3,1,12,Storage Ottoman
TEST0F9-02SKP,RB,5x5,0F9-02SKP 5x5RB,1366-1,INSIDE RAIL,ROUTER,1,ROUTER CODE 1366 5X5,RB,0.75,CNC,CNC,1366,ROUTER,3,2,12,Storage Ottoman
TEST0F9-02SKP,RB,5x5,0F9-02SKP 5x5RB,1366-2,BOTTOM FRONT RAIL,ROUTER,1,ROUTER CODE 1366 5X5,RB,0.75,CNC,CNC,1366,ROUTER,3,2,12,Storage Ottoman
TEST0F9-02SKP,RB,5x5,0F9-02SKP 5x5RB,1366-3,BOTTOM BACK RAIL,ROUTER,1,ROUTER CODE 1366 5X5,RB,0.75,CNC,CNC,1366,ROUTER,3,2,12,Storage Ottoman
TEST0F9-02SKP,RB,5x5,0F9-02SKP 5x5RB,1366-4,LEG RAIL,ROUTER-TNUT,(2) 5/16 T-NUT L&R,2,ROUTER CODE 1366 5X5,RB,0.75,CNC,CNC,1366,ROUTER,3,2,12,Storage Ottoman
TEST0F9-02SKP,RB,5x5,0F9-02SKP 5x5RB,1366-5,BOTTOM MECH RAIL,ROUTER,(2) 1/4 T-NUT L&R,2,ROUTER CODE 1366 5X5,RB,0.75,CNC,CNC,1366,ROUTER,3,2,12,Storage Ottoman

, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
[/code] So the table gets 50 blank rows, which are also imported into the DB as blank rows. Anybody got any suggestions to fix this?

Solved. Turns out I had some formulas that weren’t calculating anything and weren’t visible, and was causing the csv to export all rows that had the formula in it.

1 Like