How to insert values into Global custom text field of views programmatically?
You should be able to do that with hook_views_pre_render(). Please try the following code:

function YOUR_THEME_views_pre_render(&amp;$view) {

  switch ($view-&gt;name) {
    case 'YOUR_VIEW_NAME':
      //  override the global custom text field value
      $view-&gt;field['nothing']-&gt;options['alter']['text'] = 'My custom text';
    break;
  }
}


If the global custom text value need to be different for each view result, you can configure it using replacement patterns.



In order to programmatically insert values into Global custom text field, You can use template_preprocess_views_view_fields()

function YOUR_THEME_preprocess_views_view_fields(&amp;$vars) {
  $view = $vars['view'];

  foreach ($view-&gt;field as $id =&gt; $field) {

    // The global custom text content
    $vars['fields']['nothing']-&gt;content = 'Some global custom text content';

    // change the global custom text content depend on result (node id)
    if ($vars['row']-&gt;nid == 10) $vars['fields']['nothing']-&gt;content = 'CHANGED';
  }
}