last day (15 days later) » 

3:22 AM
1
A: Google apps script - extract 1 of 4 csv files from within a zipped email attachment & paste it into google sheets

TanaikeI believe your goal is as follows. You want to retrieve 2nd file from a ZIP file including 4 CSV files. In this case, how about the following modification? From: var csvData = Utilities.parseCsv(attachment.getDataAsString('ISO-8859-1'), ","); To: var blobs = Utilities.unzip(attachment.setConte...

 
Thanks for the help - but I am getting an error with the solution. I think it has something to do with the charset of the second csv file because when I tested on some variants - it worked OK for the first and third csv file - but if I try to parse the second csv file get error "Exception: Could not parse text." error on line 43: var csvData = Utilities.parseCsv(csvFileOf2ndFile.getDataAsString('ISO-885‌​9-1'), ","); Is there anyway to get GAS to find out what the charset is, and input that?
 
@nick Thank you for replying. From your reply, I'm worried that the 2nd file might not be the CSV data or getDataAsString('ISO-8859-1') might be able to be used. But, unfortunately, I cannot know your zip file and CSV data. But, when I tested my script using a zip file including 4 CSV files, no error occurs. I apologize for this. For example, if the reason for your current issue is due to the character code, can you provide your sample zip file including the CSV files for correctly replicating your current issue? By this, I would like to confirm it.
 
thanks so much for your help. I;' love to share the zip & files but they contain some sensitive information. The code you provided defiantly works for the other 3 csv files, just not this one. the files have all come from the same app so thought they would have been in the same format - however the second file contains the most data. so its either an encoding /charset or file length issue? is there a way I can view the charset used in a file?
 
@nick Thank you for replying. I think that your actual data is not required to be shared. In this case, it is required to confirm the sample data for correctly replicating your current issue. But, I think that the reason that I cannot correctly imagine your actual character code is due to my poor skill. I have to apologize for this.
@nick Or, your question is to retrieve one of the CSV files from a zip file. I think that my answer can resolve it. But, unfortunately, from your question, I cannot find the actual character code of your current issue. So, how about splitting your question between retrieving one of CSV file from a zip file and parsing the CSV data with the specific character code? If you can cooperate to resolve your new issue, I'm glad. Can you cooperate to do it?
 
yes please, let me know. Thank you so much for your help!
Hi Tanaike - ive split my question into 2 - does this one make sense?stackoverflow.com/questions/75797069/…
 
3:25 AM
@nick Thank you for replying. In this case, for example, can provide a sample text file including the sample texts written by the specific character code you want to use? Of course, please remove your personal information. But, if you cannot do it, please don't worry. At that time, I would like to think of another method for retrieving the character code from the data.
 
Thanks Tanaike - theres a copy of the file here 1drv.ms/x/s!Aig6ykffPH_kjckj1XKxZFsKGsJL9w?e=HbP2i7
 
Thank you for replying. I cannot understand it. I had thought that you wanted to use CSV data. But, it seems that your link is XLSX data. What should I do this?
 
hi no its a CSV file - it juts opens in Excel as I use Office365 to share it. Or is there a better way to share it?
 
Thank you for replying. For example, can you share a sample CSV file? In this case, I think that you can use Google Drive.
 
3:44 AM
Can you share it? I cannot open it.
 
sorry! try again
 
4:28 AM
Thank you for replying. When I tested your CSV file, no error occurs. So, can you provide the sample CSV file for correctly repicating your current issue?
 

last day (15 days later) »