So I'm trying to insert some date from a form into a Google sheet. In my .HTML file, I am getting the data from the form and storing in an object like:
var data = {
  name: nameInput.value,
  company: "None",
  email: emailInput.value,
  date: dateInput.value
}; 
Then I have a function that actually appends the data:
function appendData(data) {
  var ws = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Data");
  var dataArray = [];
  for (var i in data){
    dataArray.push(data[i]);
  }
  ws.appendRow(dataArray);
}
I want to insert the data in the same order as it is collected in the object (Name, company, email, date) but when I use the appedData function I get the opposite (date, email, company, name). Same happens if I use Object.values(data). The only way it works properly is if I append it manually as ws.append([data.name, data.company, data.email, data.date]). Why is this happening?
 
    