Remove First 3 Lines from a CSV before upload?

Hey guys wondering if you could point me in the right direction. I have a CSV file that gets uploaded from my users. By default, this has 3 lines on the top that they have to remove before uploading to my site.

Anyone know a way to do this. They upload csv, code removes x lines. then run a workflow to upload that to bubble datatype.

Thanks in advance. I used to do this with codeignter / php back in the day but not sure how to achieve it with bubble.

To confirm, are these three lines at the top dummy/sample data? (Ie. not some instructional fields. If they were instructional fields, that may throw off your data formatting when you export as CSV…)?

If that is the case, the easiest thing to do would be to upload the file “as is” and then to have a follow-up API workflow that deletes those three items.

1 Like

Thanks for the response. here is a csv that im looking at. I like how easy that seems however i have no idea where to start with an api and bubble.

“Start Time”,“Track”,“Series”,“Season Year”,“Season Quarter”,“Rookie Season”,“Race Week”,“Strength of Field”
“2018.08.12 3:00 AM GMT”,“USA International Speedway - Dirt”,“DIRTcar 305 Sprint Car Series”,“2018”,“3”,“N/A”,“9”,“1431”

“Fin Pos”,“Car ID”,“Car”,“Car Class ID”,“Car Class”,“Team ID”,“Cust ID”,“Name”,“Start Pos”,“Car #”,“Out ID”,“Out”,“Interval”,“Laps Led”,“Qualify Time”,“Average Lap Time”,“Fastest Lap Time”,“Fast Lap#”,“Laps Comp”,“Inc”,“Pts”,“Club Pts”,“Div”,“Club ID”,“Club”,“Old iRating”,“New iRating”,“Old License Level”,“Old License Sub-Level”,“New License Level”,“New License Sub-Level”,“Series Name”,“Max Fuel Fill%”,“Weight Penalty (KG)”
“1”,“80”,“Dirt Sprint Car - 305”,“87”,“Dirt SprintCar - 305”,“292823”,“292823”,“Kimberly Smith”,“4”,“3”,“0”,“Running”,"-00.000",“15”,"",“22.768”,“22.351”,“15”,“20”,“0”,“85”,“11”,“R”,“16”,“Pennsylvania”,“1484”,“1572”,“7”,“370”,“7”,“378”,“DIRTcar 305 Sprint Car Series”,“100”,“0”
“2”,“80”,“Dirt Sprint Car - 305”,“87”,“Dirt SprintCar - 305”,“302780”,“302780”,“Charles Barnes2”,“2”,“6”,“0”,“Running”,"-00.304",“5”,"",“22.784”,“22.267”,“15”,“20”,“0”,“77”,“9”,“4”,“23”,“Mid-South”,“1406”,“1482”,“14”,“242”,“14”,“252”,“DIRTcar 305 Sprint Car Series”,“100”,“0”
“3”,“80”,“Dirt Sprint Car - 305”,“87”,“Dirt SprintCar - 305”,“130663”,“130663”,“Steven Kakoschke”,“3”,“4”,“0”,“Running”,"-01.817",“0”,"",“22.859”,“22.352”,“9”,“20”,“0”,“69”,“7”,“5”,“34”,“Australia/NZ”,“1466”,“1522”,“7”,“349”,“7”,“359”,“DIRTcar 305 Sprint Car Series”,“100”,“0”
“4”,“80”,“Dirt Sprint Car - 305”,“87”,“Dirt SprintCar - 305”,“335471”,“335471”,“Eldon Brook”,“10”,“1”,“0”,“Running”,"-01.883",“0”,"",“22.862”,“22.172”,“20”,“20”,“2”,“61”,“5”,“4”,“34”,“Australia/NZ”,“1529”,“1566”,“6”,“241”,“6”,“250”,“DIRTcar 305 Sprint Car Series”,“100”,“0”
“5”,“80”,“Dirt Sprint Car - 305”,“87”,“Dirt SprintCar - 305”,“16649”,“16649”,“Steve Moore”,“5”,“2”,“0”,“Running”,"-07.523",“0”,"",“23.144”,“22.699”,“3”,“20”,“0”,“54”,“3”,“7”,“31”,“Great Plains”,“1517”,“1538”,“14”,“281”,“14”,“291”,“DIRTcar 305 Sprint Car Series”,“100”,“0”
“6”,“80”,“Dirt Sprint Car - 305”,“87”,“Dirt SprintCar - 305”,“21596”,“21596”,“PJ Losey”,“8”,“8”,“0”,“Running”,"-10.464",“0”,"",“23.291”,“23.005”,“15”,“20”,“6”,“46”,“1”,“5”,“26”,“Illinois”,“1400”,“1409”,“6”,“276”,“6”,“275”,“DIRTcar 305 Sprint Car Series”,“100”,“0”
“7”,“80”,“Dirt Sprint Car - 305”,“87”,“Dirt SprintCar - 305”,“277680”,“277680”,“Tim Blakely”,“6”,“9”,“0”,“Running”,"-21.671",“0”,"",“23.047”,“22.355”,“18”,“20”,“4”,“38”,“0”,“5”,“23”,“Mid-South”,“1398”,“1392”,“10”,“259”,“10”,“257”,“DIRTcar 305 Sprint Car Series”,“100”,“0”
“8”,“80”,“Dirt Sprint Car - 305”,“87”,“Dirt SprintCar - 305”,“330387”,“330387”,“James Watman”,“9”,“5”,“0”,“Running”,"-1 L",“0”,"",“23.973”,“22.797”,“11”,“19”,“4”,“30”,“0”,“4”,“34”,“Australia/NZ”,“1460”,“1434”,“6”,“272”,“6”,“275”,“DIRTcar 305 Sprint Car Series”,“100”,“0”
“9”,“80”,“Dirt Sprint Car - 305”,“87”,“Dirt SprintCar - 305”,“157266”,“157266”,“John Hagaman”,“12”,“7”,“0”,“Running”,"-2 L",“0”,"",“24.593”,“22.833”,“3”,“18”,“2”,“23”,“0”,“8”,“6”,“California Club”,“1402”,“1362”,“11”,“355”,“11”,“357”,“DIRTcar 305 Sprint Car Series”,“100”,“0”
“10”,“80”,“Dirt Sprint Car - 305”,“87”,“Dirt SprintCar - 305”,“96019”,“96019”,“Chad Fry”,“11”,“10”,“32”,“Disconnected”,"-9 L",“0”,"",“25.211”,“23.468”,“8”,“11”,“4”,“15”,“0”,“R”,“25”,“Carolina”,“1376”,“1321”,“6”,“255”,“6”,“252”,“DIRTcar 305 Sprint Car Series”,“100”,“0”
“11”,“80”,“Dirt Sprint Car - 305”,“87”,“Dirt SprintCar - 305”,“67860”,“67860”,“Ian Adams”,“1”,“11”,“32”,“Disconnected”,"-20 L",“0”,"",“00.000”,"","",“0”,“2”,“0”,“0”,“4”,“20”,“Ohio”,“1375”,“1295”,“14”,“264”,“14”,“259”,“DIRTcar 305 Sprint Car Series”,“100”,“0”
“12”,“80”,“Dirt Sprint Car - 305”,“87”,“Dirt SprintCar - 305”,“316490”,“316490”,“Chris Morse Jr”,“7”,“12”,“32”,“Disconnected”,"-20 L",“0”,"",“00.000”,"","",“0”,“0”,“0”,“0”,“5”,“12”,“New England”,“1371”,“1291”,“15”,“342”,“15”,“343”,“DIRTcar 305 Sprint Car Series”,“100”,“0”

Since those first three rows represent a different data set, you would need to manipulate the file before using the CSV uploader. (Note: my prior recommendation of using an API workflow to clean things up doesn’t apply here).

As far as I know, there is no good mechanism within Bubble for doing what you’re looking for. (Ie you’d need to run a function to upload the file, read the contents, modify, then re-export the CSV, then run that CSV through the uploader). Though I’m curious to see if anyone has a creative solution. (There may be a viable path via Blockspring, but that’s also a fair amount of work + added cost).

Since you mention your users are downloading from some sort of common source, is there an API? If so, I’d really recommend pursuing that route instead of the CSV uploader.

Great answers, much appreciated. Unfortunately no API. been trying to get them to for about 6 years lol.
If anyone comes up with a nice solution do let me know.

1 Like

its been a few years, anyone have any thoughts on how to do this.

Upload a file (Csv) remove the first 3 lines, then run it again as if uploading a csv file to insert the data into a table.

You could easily do this with parabola.io, pass it from bubble to parabola, adjust, then api back to bubble.

thank you, looking at it now.

In the long run i would really like a way to do this in bubble via a plugin or even run it though a script on the root of the bubble site, hmm