Jump to content

Add Row to Table in PythonI have an existing table with several rows on it.

Zahira Melendez

Recommended Posts

Add Row to Table in Python

I have an existing table with several rows on it. I want the script to add a row which contain values that the script is generating.I can see that the row is added but new columns are added as well. I want the row to add the values using the existing columns.

Here is what I have:rowData = "08/30/2014t" + Convert.ToString(timeRemaining) + "ttt" + Convert.ToString(manInProject) + "t" + Convert.ToString(multiplier) + "tt0rn"

# Make a stream from the stringstream = MemoryStream()writer = StreamWriter(stream)writer.Write(rowData)writer.Flush()stream.Seek(0, SeekOrigin.Begin)

# Set up the text data reader# The name of these are the same as the existing columnsreaderSettings = TextDataReaderSettings()readerSettings.Separator = "t"readerSettings.SetColumnName(0,"Date")readerSettings.SetColumnName(1,"Man Mins Remaining (from JIRA)")readerSettings.SetColumnName(2,"Task Days Remaining")readerSettings.SetColumnName(3,"Workdays remaining")readerSettings.SetColumnName(4,"Man in Project")readerSettings.SetColumnName(5,"Multiplier")readerSettings.SetColumnName(6,"Column 7")readerSettings.SetColumnName(7,"Man Days Available")

table = Document.Data.Tables[tableName]# Create a data source to read in the streamtextDataSource = TextFileDataSource(stream, readerSettings) #Also tried sending the stream ONLY but it still didn't work

# Add rowrowSettings = AddRowsSettings(table, textDataSource)table.AddRows(textDataSource, rowSettings)

Link to comment
Share on other sites

  • 1 year later...
  • 3 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...