Kobotoolbox & Google sheet Sync

I did the same steps as you did but a windows pop-up shows the error…

Hello @mohan_n ,

Thank you for this valuable tip. It works well for me.
I have a question, though.
Is it possible to exclude data from a specific question while syncing with Google Sheet? My KoBo form has a repeated group and I would like to exclude it because data from that repeated group creates additional columns. So, I cannot connect the Google Sheet as data source for Google Data Studio since the number of columns is not fixed.
I hope my question is clear.
Thanks

Chan

A cleaner version:

You can copy this sheet:

I strongly recommend GAS solutions instead of subscribing to plugins. One of the recommendations are limited with paywall. And if you have to automate the sending of confirmation email you will have to write GAS anyway or import another extension which you might have to pay.

Once you copy the code to GAS.
You can just call **=getdata(token_id, url)" in any worksheet to get the data.
However, if you have other services/scripts that interact with the google sheet I dont know if it will re-execute the function (self-update) or not.
You might need to modify the code to customize the trigger.

NEVER share your token id to anyone. Notice that the sheet is empty, you have to call getData by yourself.

The problem with a custom function is you have to expose your token_id. If you want to share the data to another person, Use get data then use importrange() or the query() function in another sheet.

This one has a custom menu. If one can follow the instructions, this is the better solution.

5 Likes

Thank you @mkmortera, for sharing this with the entire community :clap: This should be very helpful :heart:

I have followed the instructions you gave but when I save it, it shows an error Syntax error: SyntaxError: Unexpected string line: 1 file: Code.gs

Hello! I have been successfully using the code from here to import data into Google Sheets. Thanks to all who worked on it! When I import data, it makes the first tab the main form, then adds multiple tabs for my repeat groups’ data, which is what I want it to do. However, those sheets for the repeat groups do not include the “_submission__uuid” or the “_submission__id” columns, so I do not have a way to know where the data in child sheets come from when I download multiple forms into one sheet. “_parent_index” works for this as a primary key, but only when I am downloading data form one form, not multiple forms. Is there a way to adjust the code in the Google Script so the “_submission__uuid” or the “_submission__id” column will also be added to the repeat group sheets? It is in all the sheets when I do a direct download from KoboToolbox, so it seems there should be a way to add it to the google sheet through the script. I am not familiar enough with this type of code to be able to figure it out myself without breaking everything!

1 Like

Welcome to the community, @proberts_oef! Thank you for sharing this with the community. The community should be able to update the script and share it back so that it could benefit the entire users.

1 Like

Hi @mkmortera I found that when using “multiline” appearance fields, break lines disappear in googlesheets causing that one single record is splited in as many breaklines exists in a form. Is there a way to use “XLS” instead of “CSV” imports for GoogleSheet? or a way to preserve breaklines in CSV imported data to Gsheet?
Thanks for your guidance in advance.