Drupal 8: Form fields are not updating when checking triggering element
You don't need to check the triggering element if you use it's own submit handler because the submit handler is only triggered by this element.

function your_module_form_alter(&amp;$form, FormStateInterface $form_state, $form_id) {
  $form['previous_import'] = [
    '#type' =&gt; 'submit',  // changed to submit
    '#name' =&gt; 'import_previous',
    '#value' =&gt; t("Import the previous month's values"),
    '#weight' =&gt; -9999,
    '#submit' =&gt; ['import_previous_submit'],
  ];
}

function import_previous_submit(&amp;$form, FormStateInterface $form_state) {
  // Example of altering / setting the field values. You have to adapt your foreach stuff.
  $user_input = $form_state-&gt;getUserInput();
  $user_input['title'] = [['value' =&gt; 'test']];
  $form_state-&gt;setUserInput($user_input);

  $form_state-&gt;setRebuild();
}