4. Google Sheets API and reading of spreadsheets - SheilaOM/TFG GitHub Wiki
First steps with Google Sheets API
Google Sheets API is like an Excel online. Here are the steps I followed to start using Google Sheets API, running an example code.
Reading fields of spreadsheets
First, I adapt my file to be compatible with Google Sheets API, adding, among other things, the def get_credentials.
Before, the name of the fields in the NamedTuple had to be supplied by hand. Now I get these fields from a Google Sheets API spreadsheet. This sheet consists of three columns: the first, with the name of the field, the second indicates if you want to show or not this field, and the third, with the text that you want to appear with that field.
Link to commit of reading name of fields
Reading data of sreadsheet
As with the fields, I get the data from each participant of a spreadsheet. This spreadsheet consists of a series of rows (one for each participant) in which each column represents a field of data (name, twitter, affiliation ...).
Obtained these data, I insert them in the NamedTuple.
One of the data, are the url of the images. Sometimes, this url is incorrect (Error 404: Not Found), which produces an error when download them. Because of this, when I am going to download them and give an error I capture them with a try-except and I add an image that indicates that this participant doesn't have a photo (img0). Expanded: "6. Images download"
Link to commit of reading data
This version doesn't compile in Latex, because there are some symbols in the data such as &, _, # ... which are special Latex characters and must be treated (next section). I tried to treat it in the case of '_' in the twitter addresses.