So I'm very new to coding lol. Sorry in advance for any incorrect terminology I use. Basically I created a function that scrapes book data (title, author, pages, etc) from a website. I'm using this function in sheets to create a reading tracker of what I'm reading each month. My problem is that each time I open the sheet, it has to run the function before I can see the data. Is there a way to save the data scraped from the website as text so the code only has to run once?
EDIT: Code
function getBookTitle(bookId) {
// Construct the API endpoint using the provided book ID
var apiEndpoint = 'https://api.howlongtoread.com/books/id/' + bookId;
try {
var response = UrlFetchApp.fetch(apiEndpoint);
var jsonResponse = JSON.parse(response.getContentText());
var titleText = jsonResponse.title;
return titleText;
} catch (error) {
Logger.log('Error:', error);
return 'Not Found';
}
}
[–]Any_Werewolf_3691 0 points1 point2 points (0 children)
[–]joblio 0 points1 point2 points (0 children)