![]() Google Cloud > IAM & Admin > Service Accounts Think of a 'service account' as a general email account, but with no email inbox, or a general account manager that - has a email address type of moniker (ie. ![]() So there's two different kinds of 'service accounts.' By default, 'service accounts' are made by GCP as kind of general security monitor protocol, in order to de-link from any email address (personal or business). It may also be where I may be running into my 'time out' issue, since I may have at some point tweaked my permissions to my Storage bucket, and that may explain why my scripts haven't been able to access the files and are now hitting time out limit errors. This is a topic that I still have a few questions about. I would be eager to learn if you find out anything in your testing, which may be able to also assist me in trouble shooting this script even further. If any of this may help you with your testing, then feel free to post any feedback on here if you're able to get your script working. When I did all of that, I had got it working 100% initially (although lately I've been running into time out errors per my other post response). It's also important to be sure to properly link your Sheets / Apps Script to your GCP Project (which is done under the Apps Script settings), and I also had to do a lot of testing with the Buckets settings to properly set those up to be able to have the file data in the CSV retrieved for the right security and privacy protocols. I've replaced any individual key data code with a red-labeled ' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' - similar to the article, you just replace the 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' with the proper credentials provided by your Google accounts (ie. Ok, I went ahead and copied my example custom script into the Forms used in Docs Editors, which you can see here at this link: Or if you may have any other suggestions or feedback, I'd certainly appreciate it. Instead, in one of the above two examples, in testing different URL structures, one test actually overwrote the data within my bucket (and also tried to modify its metadata from a text/csv file into an application/pdf - and I have no idea where that is found in the example code per the article link illustration Lol).Īlso, would it help if I changed the function name from 'upload.' to 'download.'? function uploadFileToGCS() Would you have any reference link available? I tried to find a Google help page that describes the proper code structure for a download / PUT - but didn't find it upon initial research. from the bucket and put into Google Drive). writing from Google Drive and to Google Cloud Storage bucket) - since I'm trying to retrieve the opposite direction (ie. I also tried modifying the URL, since it appears to me that the URL string is intended for an 'upload' (ie. Or, were you referring to something else, for me to perhaps include in the 'header' line of code, as in - were you referring to this section? Should I try to make a change to this:Īuthorization: 'Bearer ' + service.getAccessToken(), Please advise: what are you referring to when you say "don't forget to include in the header the bearer from apps script" - is that what you explained further in the appsscript.json file? If so, then I have already tested it by including the right scopes added to the script - so I wouldn't think that is the source of the issue here in this code example. However, after I keyed in the appropriate params at the top of the code, and changed the METHOD to GET (instead of POST), it resulted in an error. I tried implementing the code per the article of your link. As a result, I tried implementing the sample code provided in the above article for testing purposes. The coder/author of the article mentions at the end that this is a good way to keep the data process internal, and going through OAuth keeps it even out of the service account (again, better security protocols/best practice). ![]() Since I'm relatively new to the Google Cloud space, with basic but limited understanding of Apps Script JSON-based coding knowledge/skill, I found this article (dated in 2021) which has the custom code instructions detailed already: My preference is to complete this daily automated task with the csv file marked as private, for security purposes, and if possible, to use OAuth to complete the internal retrieval of the csv data and to parse it to a spreadsheet - with the csv file to be updated with new data on a recurring basis. via Trigger) a csv that I have stored in my Google Cloud Storage bucket. My goal is to write a custom code script for a Google Sheet in Apps Script that auto-retrieves (ie.
0 Comments
Leave a Reply. |