473,320 Members | 1,724 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

csv file import only takes values of last row

When trying to load csv file data into Scribus it only takes the data of the last row.
I'm using ScribusGenerator.py by Ekkehard Will and my best guess is that the cause of the problem somewhere in this part of the code:

Expand|Select|Wrap|Line Numbers
  1. def replaceVariablesWithCsvData(self, headerRow, row, lines): # lines as list of strings
  2.         result = ''
  3.         for line in lines:
  4.             i = 0
  5.             for cell in row:
  6.                 tmp = ('%VAR_' + headerRow[i] + '%')
  7.                 line = line.replace(tmp, cell) # string.replace(old, new)
  8.                 i = i + 1
  9.             result = result + line
  10.         return result
  11.  
  12. def getCsvData(self, csvfile):
  13.         # Read CSV file and return  2-dimensional list containing the data
  14.         reader = csv.reader(file(csvfile))
  15.         result = []
  16.         for row in reader:
  17.             rowlist = []
  18.             for col in row:
  19.                 rowlist.append(col)
  20.             result.append(rowlist)
  21.         return result
Nov 13 '12 #1
0 1614

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: David Berry | last post by:
Hi All. I'm looking for any help or sample code that can show me how to make a file import wizard in ASP.NET (VB preferred) like the one that MS Access uses. I'm working on a web site where the...
5
by: Johnny Meredith | last post by:
I have seven huge fixed width text file that I need to import to Access. They contain headers, subtotals, etc. that are not needed. There is also some corrupt data that we know about and can...
5
by: osmethod | last post by:
Hello, I'd appreciate any help which is offered to my problem. I'm using Acess 97. I have a flat text file which lists names and addresses. Sometimes, these can be 4 lines and sometimes 5...
2
by: splashout1 | last post by:
Hi I have searched and found lots of stuff and played with some but couldnt get anything to even remotely work. I have a directory with multiple .csv files i would like to import them all into a...
11
by: William Foster | last post by:
Good morning all, I have an issue where I am importing a large CSV into Visual Studio 2005 - Visual Basic; as always the creators of the CSV have included the details of the data at the end file...
10
by: Avi | last post by:
Hi I need to read in a large set of text files (9GB+ each) into a database table based on fixed width lengths. There are several ways to complete this, but I am wondering if anyone has...
1
by: Child of His | last post by:
I have been through every trick I know, or has been suggested. I have a one to two million line fixed field database in text format. I want to bring it into Access 97. When I use the external...
31
by: tophandasa | last post by:
Hi all, I'm having a trouble reading a binary file as float values.I have to read the data in binary mode, then read every four bytes into a float variable. I have done my search, but i found out...
4
by: sufian | last post by:
Below is the field where user enters his/her email address and the AJAX post request is sent to the server and the user sees the message: echo("<div id=\"message\" class=\"success\">Thank you! You...
5
by: unknown418 | last post by:
I am confused what is the efficient way to read in a file with multiple values per line. Each value is separated by a space character. The values could be characters or real values. I am using...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.