Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello,
I am trying to figure out how to programmatically read and write to specific cells in a sheetnode. I have a sheetnode template, that when created, needs to reference cells from other sheetnodes. The problem is, I don't know the specific sheetnode to pull the cell from until creation, so I don't think a static token will work.
Essentially, I would like to know how to populate a new sheetnode programmatically before node_save(). Is there a specific function, or sample code you could recommend to point me how to do this?
Comments
Comment #1
Rohan.Oswal CreditAttribution: Rohan.Oswal commentedIt appears I can get the socialcalc formatted array from a node as follows:
Once I have modified the sheet as I like, I want to save this back to the sheetnode. socalcalc_save($sc) returns me $result that contains the fully formatted socialcalc format for the sheet, that i can insert into the 'value' column of the Sheetnode table, either as an update, or a new node.
Does this approach make sense?
Comment #2
ergonlogicVarious ways to access cell and range values can be found in the Views handlers. But it'd be great to provide an API for accessing and writing these directly.
Comment #3
arruk CreditAttribution: arruk commentedI was able to get the sheetnode data as follow (in Drupal 7) I hope this helps.
Comment #4
doppel CreditAttribution: doppel commentedI am trying to save a parsed sheetnode data back to its node?
Am I correct or did I miss something?
Thanks.