Comments (5)
from elixir_google_spreadsheets.
@Voronchuk sure calculating index will be fine, I was just wondering about the options
part of the append_rows
I don't see any docs about it, and I'm currently facing this error
** (FunctionClauseError) no function clause matching in GSS.Spreadsheet.append_rows/4
The following arguments were given to GSS.Spreadsheet.append_rows/4:
# 1
#PID<0.620.0>
# 2
1204476179719294976
# 3
[592700022, 1207314578675126272, 592700022, "", "CandyCrushSaga",
"Candy Crush Saga", "2019-12-18 15:00:01.000Z",
"Today we're celebrating more than just new levels; today we hit level 6000! \nShare below if you've reached that milestone yet! pic.twitter.com/HxSj0GpUpk",
""]
# 4
[pad_empty: true]
Attempted function clauses (showing 1 out of 1):
def append_rows(pid, row_index, [[cell | _] | _] = data, options) when (is_binary(cell) or cell == nil) and row_index > 0
(elixir_google_spreadsheets) lib/elixir_google_spreadsheets/spreadsheet.ex:215: GSS.Spreadsheet.append_rows/4
(elixir) lib/enum.ex:783: Enum."-each/2-lists^foreach/1-0-"/2
(elixir) lib/enum.ex:783: Enum.each/2
(twitter_feed) lib/spreadsheet.ex:36: SpreadSheet.save_to_spreadsheet/2
what will be prefered options for this? If I understand this error correctly It is telling me that some rows will be empty which is fine I guess, so not quite sure what is happening.
from elixir_google_spreadsheets.
from elixir_google_spreadsheets.
Hey ok but this is the struct which I want to save to the spreadsheet.
%TwitterFeed.Feed{
tweets: [
%TwitterFeed.Tweet{
display_name: "Candy Crush Saga",
handle_id: "592700022",
image_url: "",
text_summary: "We've got a gift for you...TWICE the number of New Levels! Let us know how you spent your day playing below! pic.twitter.com/eAVPxSAH2d",
timestamp: "2019-12-25 15:00:00.000Z",
tweet_id: "1209851293331841024",
tweet_lng: "",
user_id: "592700022",
user_name: "CandyCrushSaga"
},
%TwitterFeed.Tweet{
display_name: "Candy Crush Saga",
handle_id: "592700022",
image_url: "https://pbs.twimg.com/media/EMuUH3eWwAMVVvv.jpg",
text_summary: "Earn points and get Sweet rewards this Holiday season! You can get x4 Google #PlayPoints on everything you buy in the Year End Deals in #CandyCrush before Decem...",
timestamp: "2019-12-26 15:40:11.000Z",
tweet_id: "1210223789805637634",
tweet_lng: "",
user_id: "592700022",
user_name: "CandyCrushSaga"
},
%TwitterFeed.Tweet{
display_name: "Candy Crush Saga",
handle_id: "592700022",
image_url: "",
text_summary: "Happy Holidays from us to you! We hope you're having a Sweet time with your loved ones! \nAre you spending the festive season playing Candy Crush? Tell us when a...",
timestamp: "2019-12-24 14:00:00.000Z",
tweet_id: "1209473805816479744",
tweet_lng: "",
user_id: "592700022",
user_name: "CandyCrushSaga"
},
%TwitterFeed.Tweet{
display_name: "Candy Crush Saga",
handle_id: "592700022",
image_url: "",
text_summary: "Anybody else?! \n\nDo you spend the Holidays playing Candy Crush?https://twitter.com/JRxxxxxxx/status/1209361113487310848 …Don’t mind me \nI’ll just be playing can...",
timestamp: "2019-12-24 09:47:13.000Z",
tweet_id: "1209410188203216896",
tweet_lng: "",
user_id: "592700022",
user_name: "CandyCrushSaga"
},
%TwitterFeed.Tweet{
display_name: "App Store",
handle_id: "592700022",
image_url: "",
text_summary: "Winter offer! Get extra-special boosters that last twice as long in @CandyCrushSaga\n\nView the deal in-game: http://apple.co/CandyCrushSaga pic.twitter.com/l47U1...",
timestamp: "2019-12-23 13:20:13.000Z",
tweet_id: "1209101406126383104",
tweet_lng: "",
user_id: "74594552",
user_name: "AppStore"
},
%TwitterFeed.Tweet{
display_name: "Candy Crush Saga",
handle_id: "592700022",
image_url: "https://pbs.twimg.com/media/EMgjh7jXUAUon4_.jpg",
text_summary: "Earn points and get Sweet rewards this Holiday season! You can get x4 Google #PlayPoints on everything you buy in the Year End Deals in #CandyCrush before Decem...",
timestamp: "2019-12-23 23:32:48.000Z",
tweet_id: "1209255568038400002",
tweet_lng: "",
user_id: "592700022",
user_name: "CandyCrushSaga"
},
%TwitterFeed.Tweet{
display_name: "Candy Crush Saga",
handle_id: "592700022",
image_url: "https://pbs.twimg.com/media/EMe37k9WkAAb6tI.jpg",
text_summary: "What a nice surprise!! It's Tiffi! Have you added all the new character costumes to your collection yet?! pic.twitter.com/XWbzNytJTX",
timestamp: "2019-12-23 15:42:43.000Z",
tweet_id: "1209137264145653769",
tweet_lng: "",
user_id: "592700022",
user_name: "CandyCrushSaga"
},
%TwitterFeed.Tweet{
display_name: "Candy Crush Saga",
handle_id: "592700022",
image_url: "https://pbs.twimg.com/media/EMOZdAHWwAAgL5b.jpg",
text_summary: "Treat yourself to a crossword this weekend...Candy Crush style #CrossWordPuzzleDaypic.twitter.com/egvJL5EkS1",
timestamp: "2019-12-21 14:00:00.000Z",
tweet_id: "1208386641011904512",
tweet_lng: "",
user_id: "592700022",
user_name: "CandyCrushSaga"
},
%TwitterFeed.Tweet{
display_name: "Candy Crush Saga",
handle_id: "592700022",
image_url: "",
text_summary: "What could be more Sweet than a home-made card? \n\nFollow the easy steps below to learn how to make a Candy Crush card for your loved ones and be sure to tag us ...",
timestamp: "2019-12-20 16:02:07.000Z",
tweet_id: "1208054984597819399",
tweet_lng: "",
user_id: "592700022",
user_name: "CandyCrushSaga"
},
%TwitterFeed.Tweet{
display_name: "Candy Crush Saga",
handle_id: "592700022",
image_url: "",
text_summary: "Holidays are just around the corner but, wait! You can still make that Delicious Gift for your special one! \n\nGet them a Google Gift Card before New Year’s Eve ...",
timestamp: "2019-12-19 17:46:08.000Z",
tweet_id: "1207718774943694848",
tweet_lng: "",
user_id: "592700022",
user_name: "CandyCrushSaga"
},
%TwitterFeed.Tweet{
display_name: "Candy Crush Saga",
handle_id: "592700022",
image_url: "",
text_summary: "Has anyone else got to level 6000 yet?! \n\nWe want to know!https://twitter.com/cesar_ogata/status/1207514179315392512 …Level 6000 !! pic.twitter.com/1EHvB5G8xO",
timestamp: "2019-12-19 11:02:38.000Z",
tweet_id: "1207617229082288128",
tweet_lng: "",
user_id: "592700022",
user_name: "CandyCrushSaga"
},
%TwitterFeed.Tweet{
display_name: "Candy Crush Saga",
handle_id: "592700022",
image_url: "",
text_summary: "Today we're celebrating more than just new levels; today we hit level 6000! \nShare below if you've reached that milestone yet! pic.twitter.com/HxSj0GpUpk",
timestamp: "2019-12-18 15:00:01.000Z",
tweet_id: "1207314578675126272",
tweet_lng: "",
user_id: "592700022",
user_name: "CandyCrushSaga"
},
%TwitterFeed.Tweet{
display_name: "Candy Crush Saga",
handle_id: "592700022",
image_url: "",
text_summary: "Reasons to play Candy Crush: \n\nWhat are yours? Let us know below! https://twitter.com/theroyalfinesse/status/1207233349686906880 …1. My Go to Stress Reliever.\n2...",
timestamp: "2019-12-18 09:49:38.000Z",
tweet_id: "1207236471482175488",
tweet_lng: "",
user_id: "592700022",
user_name: "CandyCrushSaga"
},
%TwitterFeed.Tweet{
display_name: "Candy Crush Saga",
handle_id: "592700022",
image_url: "",
text_summary: "Who can give us THREE reasons why Candy Crush was the most important app you used this year?! https://twitter.com/AppStore/status/1206621005076189185 …What’s th...",
timestamp: "2019-12-17 10:42:51.000Z",
tweet_id: "1206887475651776512",
tweet_lng: "",
user_id: "592700022",
user_name: "CandyCrushSaga"
},
%TwitterFeed.Tweet{
display_name: "Candy Crush Saga",
handle_id: "592700022",
image_url: "",
text_summary: "Us too https://twitter.com/JEUmogbai/status/1206841388467404800 …Curious to find out: \"what level are you on in the @CandyCrushSaga",
timestamp: "2019-12-17 10:07:50.000Z",
tweet_id: "1206878661388967937",
tweet_lng: "",
user_id: "592700022",
user_name: "CandyCrushSaga"
},
%TwitterFeed.Tweet{
display_name: "Candy Crush Saga",
handle_id: "592700022",
image_url: "",
text_summary: "That's the #MondayMotivation we need today!! \n\nHow do you feel when you pass a level?! https://twitter.com/hessaa_alk/status/1206524514324099077 …i won a very h...",
timestamp: "2019-12-16 11:51:28.000Z",
tweet_id: "1206542353756033025",
tweet_lng: "",
user_id: "592700022",
user_name: "CandyCrushSaga"
},
%TwitterFeed.Tweet{
display_name: "Candy Crush Saga",
handle_id: "592700022",
image_url: "https://pbs.twimg.com/media/ELqGjMzWsAAjDzC.jpg",
text_summary: "We're spilling the tea; Candy Crush goes nicely with a cup of your favorite hot drink ! \nWhat's your favorite flavour of tea?! \n\nThanks @nikki_starr_ for sharin...",
timestamp: "2019-12-15 14:00:00.000Z",
tweet_id: "1206212313583366144",
tweet_lng: "",
user_id: "592700022",
user_name: "CandyCrushSaga"
},
%TwitterFeed.Tweet{
display_name: "Candy Crush Saga",
handle_id: "592700022",
image_url: "",
text_summary: "Follow the steps in the video to create your very own Color-Bomb decoration! \nA festive DIY delight! Make your very own Color-Bomb Bauble to decorate your tree ...",
timestamp: "2019-12-13 14:00:00.000Z",
tweet_id: "1205487536623280128",
tweet_lng: "",
user_id: "592700022",
user_name: "CandyCrushSaga"
},
%TwitterFeed.Tweet{
display_name: "Candy Crush Saga",
handle_id: "592700022",
image_url: "",
text_summary: "Couldn't agree more https://twitter.com/MKarelyn/status/1205348068864004100 …If you really love someone you show it by sending them unsolicited candy crush live...",
timestamp: "2019-12-13 10:47:22.000Z",
tweet_id: "1205439061135167489",
tweet_lng: "",
user_id: "592700022",
user_name: "CandyCrushSaga"
},
%TwitterFeed.Tweet{
display_name: "Candy Crush Saga",
handle_id: "592700022",
image_url: "",
text_summary: "The new @JumanjiMovie has brought Candy Crush to The Next Level! Play the exclusive in-game event with @TheRock and @KevinHart4Real for three-days only! Be sure...",
timestamp: "2019-12-10 19:01:13.000Z",
tweet_id: "1204476179719294976",
tweet_lng: "",
user_id: "592700022",
user_name: "CandyCrushSaga"
}
]
}
Function which is doing all this is
def save_to_spreadsheet(handle, start_after_tweet \\ 0) do
{:ok, pid} = GSS.Spreadsheet.Supervisor.spreadsheet("1Xs", list_name: "candy")
fetch_tweets =
TwitterFeed.get_tweets(handle, start_after_tweet)
save_to_candy =
fetch_tweets.tweets
|> Enum.with_index(1)
|> Enum.each(fn {tweet, index} ->
GSS.Spreadsheet.append_rows(pid, index,
[ tweet.handle_id,
tweet.tweet_id,
tweet.user_id,
tweet.tweet_lng,
tweet.user_name,
tweet.display_name,
tweet.timestamp,
tweet.text_summary,
tweet.image_url,
]
)
end)
{:ok, save_to_candy}
end
I've manually converted integer to strings but I'm still facing the same error.
from elixir_google_spreadsheets.
@Voronchuk nevermind, I have just used append_row
instead and it's working like a charm, thanks for this awesome library and your help.
from elixir_google_spreadsheets.
Related Issues (20)
- 26 column limit? HOT 4
- Spec is wrong, leading to spurious dialyzer warnings HOT 2
- Timeout HOT 23
- Separate API layer from Server
- Split GSS.Registry into authorization and process management layers
- Max rows HOT 2
- Question - Check if a specific sheet exists and fallback to a default one HOT 3
- Should error tuples return exception atoms or structs?
- Tests aren't consistently passing HOT 5
- Conflicting httpoison versions HOT 4
- Read/Write from different sheets HOT 1
- Append multiple rows at once? HOT 5
- Support to Delete Rows HOT 1
- ** (File.Error) could not read file "./google/service_account.json": no such file or directory HOT 4
- Not been able to save data into spreadsheet, google API connection problem HOT 1
- Question about release version HOT 3
- Avoiding process leakage in web request. HOT 2
- Can I use the library to access Google Spreadsheets of users who sign in with Google OAuth? HOT 1
- SSL certificate issue HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elixir_google_spreadsheets.