Last row isn't being extracted (macro script)

已查看 136 次
跳至第一个未读帖子

Hussein Osseily

未读,
2021年10月17日 19:31:002021/10/17
收件人 Google Apps Script Community
Hello everyone, 

This is my very first kinda interaction here. 

I have written a script in google spreadsheet to extract data from a table and send it automatically by email. 

Its all working great for now , but i am having these 2 problems that I hope that someone might help me solve it: 

1st problem: 

The extracted data isn't including the last row of the table, if the table has 50 rows, its only extracting 49 rows.

2nd Question is: 

I have a table that has the customer name and customer email address. 
Lets say the same customer has 2 emails, should I create 2 rows for the same customer or i can add both emails in 1 cell ? 

Example: 

Customer 1   imp...@customer1.com 
Customer 1   Mark...@customer1.com 

or 

Customer 1   imp...@customer1.com ; mark...@customer1.com (in one cell)

Thank you in advance 

Clark Lind

未读,
2021年10月21日 17:33:212021/10/21
收件人 Google Apps Script Community
Hello,
If you can provide some sample code, it is much easier for someone to see a mistake or error or typo, etc. 
In the first problem, without seeing your code, I can only guess that the nature of the problem has to do with arrays being zero-based. 
Example,  
const range = ...getRange("A1:A10).getValues();

range[0] [0] contains whatever is in cell A1
range[1] [0] contains whatever is in cell A2
...
...
range[9] [0] contains whatever is in cell A10

For your second question, I would create another column, not row. Email1 and Email2, just like you might have "Home Phone" and "Mobile Phone". Just treat additional items as additional fields in a database table.

回复全部
回复作者
转发
0 个新帖子