Report post

Are you sure you want to report the post shown below? This will send an email to the ATVO administrators. Please include a short reason for reporting.

Users reporting for no reason may be locked out.


Post

Posted by Nick Thissen
on
Harold Darner wrote:
I have found a solution of sorts but I am trying to figure a way to grab a cell associated with a DriverID from a .csv file within the script. Has anyone tried that?
Grabbing data from a spreadsheet is easy, especially if your spreadsheet has a clear unique identifier column and you can grab the data via that identifier. For example if DriverID (customer ID) is your identifier in the first column of the spreadsheet you can simply call "FindRow" on the spreadsheet and get the data in each column in an array:
var id = "123456"; 			// Must be a string
id = entity.Id.ToString(); // Or convert the Id from an IEntity

// Find spreadsheet by name
var s = item.Theme.Spreadsheets.Find("test.csv");

// Get row data
var row = s.FindRow(id);

// 'row' is an array of objects, one per column
var col1 = row[0].ToString();
var col2 = row[1].ToString();
var col3 = row[2].ToString();

// You can also find rows by data in other columns (not the first, identifier column)
var otherId = "Driver name which is in the third column"
var otherRow = s.FindRow(otherId, 2); // Look in the 3rd column (zero-based)