Google App Script Spreadsheet Form error - forms

Separate issue raised with Google by st...#ditoweb.com here (issue 2391)
We have an iframe-based spreadsheet form on a website (http://www.monarch-equestrian.co.uk/brochurerequest.html) which is set to generate emails with attached PDF's to respondents.
Over the past few days, this has been generating an error notification - "You do not have permission to call getActiveSpreadsheet". The script, triggered on submission, has been working perfectly - however the spreadsheet had grown to 1387 rows so we archived it and deleted most of the records in the original (in case we had reached the limit allowed and so we wouldn't have to create a new spreadsheet etc).
The question is, even though the spreadsheet is presumably now within data limits and all the settings are unchanged, why are we still getting the error?

According to the reported issue noted in the question, this was fixed Feb 25, 2013.

Related

Updating a timestamp if a previous submission is older than a newer submission

So Im working on a gaming community and have a "Roll Call" form they fill out each day they play with us so we can track if they are active. This form comes with name, the unit they are in and the timestamp when it was submitted (only important pieces). It is all sent to a google sheets page and has a google forms page linked.
What I am trying to do is to have it so in their roster, the most recent roll call will update a cell next to their name with the date submitted, while also changing the colour of the cell to indicate if it fits within a certain time period.
Currently, I have tried =IF('Roll Call'!A3:A<TODAY(-3)AND('Roll Call'!B3:B=D6),"ACTIVE","Innactive")
A3:A is all timestamps logged, B3:B is the name submitted and D6 on the sheet is the name of the person. Eventually I want it to be that if submitted within 3 days they are active, if submitted within 3-6 days its inactive and after 7 days they are "AWOL".
For now, Im not fussed about the changing colours based on activity, I just want it to auto update the last submitted timestamp in Day/Month/Year format based on the name of the person submitted. Anyone able to direct me and help me in any way?
Main Roster Page
Raw data roll call page
try:
=IF(IFNA(FILTER('RAW - ROLL CALL'!A2:A, 'RAW - ROLL CALL'!A2:A<TODAY()-3, 'RAW - ROLL CALL'!B2:B=E6))="",
"ACTIVE", "INNACTIVE")

Zapier: from spreadsheet to Facebook Offline events tracking

I've got a database containing offline conversions (email, phone, name, purchase_amount, etc). I can export this database in .csv or .xls and I can also email this file on a daily basis to a Gmail account.
As Zapier has a Google Sheet to "Facebook offline event" API, I tried this workflow with Zapier.com:
Export my database in .xls: OK
Mail it to my Gmail account as an email attachment: OK
Grab the attachment and upload file to Google Drive using Zapier: OK
This is the part where I'm in trouble: I want to copy the content of the .xls file that is on Google Drive to a new Google Sheet. I can't figure out how to do this in Zapier.
Finally, on every new spreadsheet created or new row added (depending on how I configure the Zap) , pushing the data to Facebook API.
I'm not a developer so I want to avoid coding if possible. I tought I could easily do it with zapier but it seems that working with data inside a file is not so easy.
Any help would be much appreciated.
Thank you,
Best regards,
Tim.
If it were me I would look into the scripting capabilities of Google Sheets to try and achieve this, having your code execute from a single place eliminates other possible points of failure. That said, I have put together a somewhat hacky, code free solution that should set you up to do what you are looking to achieve. I break it down step by step below:
Step 1: Export database as .csv file. I could only get this to work with .csv files and not .xlsx files. There may be the ability to do so but it would require further trial and error.
Step 2: Mail it to your Gmail account where I assume there is a Zap which triggers to upload the attachment to your drive account automatically.
Step 3: Setup a second Zap that is connected to your Gmail account
that triggers when you receive an email with an attachment.
Step 4: Isolate the attachment file from the results of the triggered Zap and use it as input for the following formatter action step.
Step 5: Setup your formatter action step using the text option. Within the formatter template select trim white space and use the attachment, isolated from the trigger step, as its input. See example photo here.
Step 6: Setup your final step which is the create Google Sheet function of the Google Sheets Zap. Enter a title for your new sheet, it will probably need to be a unique value I used the attachment ID from step one as my title but you can set it to whatever you would like. In the headers section type =IMPORTDATA("") . Between the two quotation marks place the output of the previous formatter step and then run the Zap. See example photo here.
Explanation: When Zapier catches the attachment file from your inbound email it seems to be stored as raw data. Given this we cannot simply dump this information into a spreadsheet as it would be unreadable. However it seems Zapier has a method for converting this raw data through the endpoint https://zapier.com/engine/hydrate. When we input the raw attachment data into the formatter step Zapier provides a link pointing to the URL for converting the data into its original format. We take this URL and using the Google worksheet function IMPORTDATA() we are able to import the file using Zapier's file conversion engine. Now that the data is in your new sheet you can set up an additional Zap to do something with it. Also note that the Zap to upload the attachment to your Google Drive is not necessary with this setup. That said if you are looking to keep backups of your data then keep it on otherwise you may have the opportunity to save yourself some zaps.
Hope this helps!
Many thanks for your awesome reply. I also tried the "trim whitespace" to get the data back. I only missed the "importdata" function which is super powerful. Indeed it only works with .csv. With .xls file, importdata gives the source code of xls file which is useless.
I ended with 2 zaps:
Grab Gmail attachment, upload to Google Drive (for backup & monitoring) and create new spreadsheet
Send Facebook offline conversion when new spreadsheet is added (filter: only continue when file name is xxxx), lookup spreadsheet row (I took one column that has the same value for each row) and finaly I could match my columns with the Facebook API.

youtube reporting api Internal error encountered., youtube-analytics-api

I use the youtube bulk reports (youtube analytics and reporting api) and get few of the reports on a daily basis , by first listing the reports available for the jobs I have defined and then downloading. The API call made to list the reports available "https://youtubereporting.googleapis.com/v1/jobs/{jobId}/reports" is consistently giving 500, Internal error for the whole day ( 5/14/2017) , where as the query to list jobs does give the required list of jobs (https://youtubereporting.googleapis.com/v1/jobs). I have tried this from my code which has been working for past several months as well as from the Oath Playground tool.
Questions
(a) How does one get more information when this happens, the error in documentation just asks to try later
(b) Is there a place we can see the status of youtube-analytics-api health, so that we know there is a production issue , if any

(drupal) Webform2pdf blank submitted data tokens when PDF send by mail

I run into an issue with module webform2pdf, which I am too unable to solve for a few days. I am using Commerce Kickstart as a drupal commerce module for handling all the shopping fuctionality, and we were in need to add webforms for returns policy (required by law in my country).
This form has many fields, like when you have pursached the product, what is it's serial number etc. Webform2pdf module was used for sending submitted data as PDF as attachment to email. But the received PDF by mail has blank data tokens, no matter how I try. Weird thing is, that when I hit download PDF in administration of drupal website, it just fills the data tokens right.
I have tried many tokens, all of these:
[submission:values:meno:withlabel]
[submission:values:meno]
[webform:val-meno]
[webform:meno]
%email[meno]
%email_values
%label_nl[meno]
%nl[meno]
%label_all[meno]
%label_all_nl[meno]
%all[meno]
%all_nl[meno]
[submission:values]
%value[meno]
Neither of them works, most of them simply prints token label. For example [submission:values] prints all the labels, but no data.
Upper in the mail, I have also token:
%label_all[typ_servisu]
Which prints correctly when sent via mail, but refuses to print when "download PDF" in administration. This token holds select radio buttons.
I have also tried send pdf as attachment via Rules, but with no success. I am not very experienced developer.
Any advice would be greatly appreciated. Thank you.

Magento Strange Redirect Behaviour on OnePage Checkout

My Magento Verison is - 1.4.1.1
I am having two problems:
1) When I am going through various steps of Onepage checkout (registration, billing, shipping, and payment tabs), sometimes during this process I am redirected to the cart page. There is no error, no exception, no report gets generated in var/report. I dont know how to debug it. Aren’t there any logs I can look for?
2) In same Onepage Checkout process after clicking on place the order (last step) , some times it redirects to the cart page, sends an email saying that the order failed with the message:
Quote totals must be collected before this operation.
To resolve it I commented this line in prepareRecurringPaymentProfiles in the file magento/app/code/core/Mage/Sales/Model/Quote.php, which solved the problem:
throw new Exception("Quote totals must be collected before this operation.");
I dont know if these 2 problems are related or not. But I am not having the 2nd problem now but having 1st one quite frequent. What could be the reason and how to resolve it?
further update-I checked the firebug trace, It is 500 internal server error which comes sometimes in any of the step in one page checkout. I was able to dig down into savebillingaction, saveshippingaction functions in onepagecontroller.php and found that error comes when $this->getRequest()->isPost() is blank , If it is 1 then it goes ahead, and goes to the next step else it redirects to cart, No I dont know why this is not 1 or is it because ajax is not able to send post data but I checked XHR request, Ajax send the post data every time (checked with firebug extension). Can Someone tell me What I could do next to troubleshoot. Where I can look for these Ajax Calls?
Shipping.phtml (any step.phtml) has JS at the bottom , How does it call OnePagecontroller saveshippingaction function ?
Since it's internal server error, try to access the error log of the server. Will tell you where is the problem. I' ve had the same problem in 1.7.0. In my example the problem was at /app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex.php
For anyone else coming across the "Quote totals must be collected before this operation." error, check your Apache logs for the reason of the 500 internal server error. If it's something like this:
mod_fcgid: read data timeout in 40 seconds
Premature end of script headers: index.php
process 26126 graceful kill fail, sending SIGKILL
..PHP is taking too long to respond. Usually its the onepage/checkout saveOrder action because it's quite heavy and often needs to connect to third party services (payment gateways, newsletter services like mailchimp, etc.). These calls to third party services can take a while, depending on the network state and might be the reason of PHP timing out.
You can start by increasing the timeout, but it's not a good permanent solution because you want to find out why this is happening in the first place.
New Relic is a good tool to monitor these calls (and a good tool to monitor your Magento store in general).
Firstly, commenting an error message is almost never the way to solve a problem, as you are just covering up some issue that may have severe consequences for your system.
Nailing down errors like this can be hard, but there are a few places to look first:
Did you install this system on a lower version and then upgrade? If so, how?
Are you using any extensions that modify the sales/checkout portion of the site?
Have you overridden any of the models concerned with this part of the site?
Have you changed the JS or HTML for the checkout?
If one of those is the case, you should review those changes for bugs. If not, try turning on the default theme for the site and checking out again. If the bug disappears, there is a problem with the theme that you are using. If it still appears, the problem is in code.
In that latter case, use Firebug to verify that the offending page requests result in Magento sending back "redirect" commands to the frontend. If that isn't the case, it may be some kind of JS error, but more likely you are ending up with invalid data in the system somewhere that causes Magento to choke during checkout.
Also (just thought of this, haven't tried it), try the multi-address checkout. As I recall, it uses regular page posts, and may even have more useful messaging than the OnePage checkout. Please edit your post with your findings from the above so that we can help more if that doesn't do it.
Hope that helps!
Just in case someone gets the "Quote totals must be collected before this operation." error, and none of these solutions fixes their particular problem, I'll mention that mine was an issue with this:
skin/frontend/base/default/js/opcheckout.js
var params = Form.serialize(payment.form);
There was a JS error unique to this site which was clearing the Payment form and preventing JS from reading it's contents. The module or theme that you use will differ, but check to make sure that the payment form can serialize correctly. If not, then that could be your problem.
I had the very same problem on my store Princessly:
It takes about 20 to 130 seconds or even longer for "Submitting order information ..." to go through and redirect to the payment gateway such as PayPal, if at all, after clicking the Place Order button, last step of one page checkout.
If it doesn't go through, very probably because something timed out since it took too long, it will redirect back to shopping cart, leaving the customer an empty cart and a Pending Payment order, OR, it will give the exception of:
Quote totals must be collected before this operation.
Since obviously, well, something timed out and the script ends before quote totals are collected (which is just my theory), thus sending the Payment Transaction Failed Reminder email.
After 12 hours of research and debug, I finally found the culprit and the solution.
Magento enables RSS stock and new order notification by default, so every time Place Order is pressed ('sales/order' resources are then saved), cache is refreshed so RSS will be published. Cache cleaning can be very time-expensive for Magento. Therefore the solution is simple. Just disable RSS notification for save of 'sales/order' resources.
Find /app/code/core/Mage/Rss/etc/config.xml and locate this block:
<sales_order_item_save_after>
<observers>
<notifystock>
<class>rss/observer</class>
<method>salesOrderItemSaveAfterNotifyStock</method>
</notifystock>
</observers>
</sales_order_item_save_after>
<sales_order_item_save_after>
<observers>
<ordernew>
<class>rss/observer</class>
<method>salesOrderItemSaveAfterOrderNew</method>
</ordernew>
</observers>
</sales_order_item_save_after>
Simply remove or comment it out and refresh Magento cache in System => Cache Management => Select All => Submit.
Now it only takes 1 second or even less for my store to go through Place Order and redirect to payment gateway.