Giter Site home page Giter Site logo

elixir_google_spreadsheets's People

Contributors

adzz avatar alex88 avatar dianaolympos avatar dparnell avatar johnhamelink avatar monsieurv avatar peburrows avatar tomtaylor avatar trusty avatar voronchuk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

elixir_google_spreadsheets's Issues

** (File.Error) could not read file "./google/service_account.json": no such file or directory

Hey, after I run all the configuration and played with the library, it just stoped working, so I'm using

elixir -v
Erlang/OTP 22 [erts-10.4.4] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [hipe] [dtrace]

Elixir 1.9.1 (compiled with Erlang/OTP 22)

I followed your README file for configuration, I have added this into my config.exs

config :goth, json: "./google/service_account.json" |> File.read!

config :elixir_google_spreadsheets, :client,
  request_workers: 50,
  max_demand: 100,
  max_interval: :timer.minutes(1),
  interval: 100

But now when I start iex -S mix all I got is

➜  twitter_feed git:(master) ✗ iex -S mix
Erlang/OTP 22 [erts-10.4.4] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [hipe] [dtrace]

** (File.Error) could not read file "./google/service_account.json": no such file or directory
    (elixir) lib/file.ex:353: File.read!/1
    (stdlib) erl_eval.erl:680: :erl_eval.do_apply/6
    (stdlib) erl_eval.erl:888: :erl_eval.expr_list/6
    (stdlib) erl_eval.erl:240: :erl_eval.expr/5
    (stdlib) erl_eval.erl:232: :erl_eval.expr/5
    (stdlib) erl_eval.erl:888: :erl_eval.expr_list/6
    (stdlib) erl_eval.erl:411: :erl_eval.expr/5
    (stdlib) erl_eval.erl:126: :erl_eval.exprs/5

the json is there in the folder and that path is fine, did you maybe encountered something similar? Thanks.

Question about release version

The readme mentions {:elixir_google_spreadsheets, "~> 0.1.15"} , but it seems that the latest release was 0.1.14? Maybe I'm not looking at this correctly? Or maybe we just need a new release?

Thanks!

Screen Shot 2020-01-03 at 07 51 36

Question - Check if a specific sheet exists and fallback to a default one

Hi!

I'm using the library and it has been great so far! We started to make things a little more dynamic and I wanted to ask you if you suggest a particular strategy regarding trying to open a specific sheet, if the sheet doesn't exist, defaulting to a main one.

I've tried it a couple of ways, but it seems that I can't trap the error I keep getting when trying a sheet that may not exist. We kind of need to refer to it by name. Here is the error:

** (WithClauseError) no with clause matching: {:ok, %HTTPoison.Response{...}}

I tried matching against the error, try/rescue, try/catch, but I can't seem to make it work. I was wondering if you have solved an issue like this before.

Please let me know if you need more details about this and I'll provide them. Thanks!

SSL certificate issue

Not 100% sure this comes from the library, but I have this warning:

12:30:20.580 [warning] Description: 'Authenticity is not established by certificate path validation'
     Reason: 'Option {verify, verify_peer} and cacertfile/cacerts is missing'

And after letting the VM running, this error:

10:32:37.311 [error] GenServer {Goth.Registry, GSS.Goth} terminating
** (RuntimeError) too many failed attempts to refresh, last error: %RuntimeError{message: "{:tls_alert, {:unknown_ca, 'TLS client: In state wait_cert_cr at ssl_handshake.erl:2032 generated CLIENT ALERT: Fatal - Unknown CA\\n'}}"}
    (goth 1.3.0-rc.3) lib/goth/server.ex:80: Goth.Server.handle_info/2
    (stdlib 3.17) gen_server.erl:695: :gen_server.try_dispatch/4
    (stdlib 3.17) gen_server.erl:771: :gen_server.handle_msg/6
    (stdlib 3.17) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Last message: :refresh
State: %Goth.Server{http_client: {Goth.HTTPClient.Hackney, %Goth.HTTPClient.Hackney{default_opts: []}}, name: GSS.Goth, refresh_before: 300, retries: 1, retry_after: 1000, source: {:service_account, %{"auth_provider_x509_cert_url" => "https://www.googleapis.com/oauth2/v1/certs", "auth_uri" => "https://accounts.google.com/o/oauth2/auth", "client_email" => "<blabla>.iam.gserviceaccount.com", "client_id" => "id", "client_x509_cert_url" => "https://www.googleapis.com/robot/v1/metadata/x509/<path>", "private_key" => "-----BEGIN PRIVATE <priavte>\n-----END PRIVATE KEY-----\n", "private_key_id" => "<id>", "project_id" => "<project-id>", "token_uri" => "https://oauth2.googleapis.com/token", "type" => "service_account"}, [scopes: ["https://www.googleapis.com/auth/spreadsheets"]]}}

Is this normal?

It seems to me that with have the latest HTTP clients, so we should not get such cert issues, but I certainly miss something.

Split GSS.Registry into authorization and process management layers

Currently all spreadsheet process and Goth auth token are tracked by GSS.Registry module.

Put spreadsheet process tracking into a separate Elixir native Registry instance.

Scope out GSS.Auth module from a current GSS.Registry which will manage Goth auth token: headers = %{"Authorization" => "Bearer #{GSS.Auth.token}"} instead of headers = %{"Authorization" => "Bearer #{GSS.Registry.token}"}

26 column limit?

Hi, we're looking for a library to write to a google sheet. We need to write considerably more than 26 columns, I wonder if this limitation is something that's fairly easy to remove?

Avoiding process leakage in web request.

The way we're trying to use this library is by appending to a Google Sheet in the process of a web request. However when you do GSS.Spreadsheet.Supervisor.spreadsheet(sheet_id) it will create a process under the GSS.Spreadsheet.Supervisor supervision tree. These don't get cleaned up so those processes never stop running which causes a "process leak".

You can see them pooling up here:
image

The workaround for us is to do this:

with {:ok, pid} <- GSS.Spreadsheet.Supervisor.spreadsheet(sheet_id),
  # do stuff to it...
  :ok = Supervisor.terminate_child(GSS.Spreadsheet.Supervisor, pid) do
:ok
end

I feel like the design of the library kind if encourages you to do this.

Can't access sheet with space in name

When trying to access a spreadsheet using A2 notation, or using the list_name: argument the process dies and gives a metric crap-ton of output.

After some debugging, a solution: use %20 instead of spaces. I suggest the lib do this automatically (as my sheet is test sheet not test%20sheet).

Separate API layer from Server

Currently both API and GenServer callbacks are defined under the single GSS.Spreadsheet module.

We should leave API layer in GSS.Spreadsheet and transfer callbacks into a separate GSS.Spreadsheet.Server module.

Update the related supervisors, limiters, tests (all tests should pass).

Timeout

Hello,

I'm getting the following timeout error:

erlang error: {:timeout, {GenServer, :call, [#PID<0.12345.10>, {:read_rows, 2, 250, [column_to: 26]}, 5000]}}

The read rows call I'm using is:

GSS.Spreadsheet.read_rows(pid, 2, 250 column_to: 26)

Looking in the logs, the request looks like:

https://sheets.googleapis.com/v4/spreadsheets/REDACTED/values:batchGet?majorDimension=ROWS&valueRenderOption=FORMATTED_VALUE&dateTimeRenderOption=FORMATTED_STRING&ranges=A2:Z2&ranges=A3:Z3&ranges=A4:Z4&ranges=A5:Z5&ranges=A6:Z6&ranges=A7:Z7&ranges=A8:Z8&ranges=A9:Z9&ranges=A10:Z10&ranges=A11:Z11&ranges=A12:Z12&ranges=A13:Z13&ranges=A14:Z14&ranges=A15:Z15&ranges=A16:Z16&ranges=A17:Z17&ranges=A18:Z18&ranges=A19:Z19&ranges=A20:Z20&ranges=A21:Z21&ranges=A22:Z22&ranges=A23:Z23&ranges=A24:Z24&ranges=A25:Z25&ranges=A26:Z26&ranges=A27:Z27&ranges=A28:Z28&ranges=A29:Z29&ranges=A30:Z30&ranges=A31:Z31&ranges=A32:Z32&ranges=A33:Z33&ranges=A34:Z34&ranges=A35:Z35&ranges=A36:Z36&ranges=A37:Z37&ranges=A38:Z38&ranges=A39:Z39&ranges=A40:Z40&ranges=A41:Z41&ranges=A42:Z42&ranges=A43:Z43&ranges=A44:Z44&ranges=A45:Z45&ranges=A46:Z46&ranges=A47:Z47&ranges=A48:Z48&ranges=A49:Z49&ranges=A50:Z50&ranges=A51:Z51&ranges=A52:Z52&ranges=A53:Z53&ranges=A54:Z54&ranges=A55:Z55&ranges=A56:Z56&ranges=A57:Z57&ranges=A58:Z58&ranges=A59:Z59&ranges=A60:Z60&ranges=A61:Z61&ranges=A62:Z62&ranges=A63:Z63&ranges=A64:Z64&ranges=A65:Z65&ranges=A66:Z66&ranges=A67:Z67&ranges=A68:Z68&ranges=A69:Z69&ranges=A70:Z70&ranges=A71:Z71&ranges=A72:Z72&ranges=A73:Z73&ranges=A74:Z74&ranges=A75:Z75&ranges=A76:Z76&ranges=A77:Z77&ranges=A78:Z78&ranges=A79:Z79&ranges=A80:Z80&ranges=A81:Z81&ranges=A82:Z82&ranges=A83:Z83&ranges=A84:Z84&ranges=A85:Z85&ranges=A86:Z86&ranges=A87:Z87&ranges=A88:Z88&ranges=A89:Z89&ranges=A90:Z90&ranges=A91:Z91&ranges=A92:Z92&ranges=A93:Z93&ranges=A94:Z94&ranges=A95:Z95&ranges=A96:Z96&ranges=A97:Z97&ranges=A98:Z98&ranges=A99:Z99&ranges=A100:Z100&ranges=A101:Z101&ranges=A102:Z102&ranges=A103:Z103&ranges=A104:Z104&ranges=A105:Z105&ranges=A106:Z106&ranges=A107:Z107&ranges=A108:Z108&ranges=A109:Z109&ranges=A110:Z110&ranges=A111:Z111&ranges=A112:Z112&ranges=A113:Z113&ranges=A114:Z114&ranges=A115:Z115&ranges=A116:Z116&ranges=A117:Z117&ranges=A118:Z118&ranges=A119:Z119&ranges=A120:Z120&ranges=A121:Z121&ranges=A122:Z122&ranges=A123:Z123&ranges=A124:Z124&ranges=A125:Z125&ranges=A126:Z126&ranges=A127:Z127&ranges=A128:Z128&ranges=A129:Z129&ranges=A130:Z130&ranges=A131:Z131&ranges=A132:Z132&ranges=A133:Z133&ranges=A134:Z134&ranges=A135:Z135&ranges=A136:Z136&ranges=A137:Z137&ranges=A138:Z138&ranges=A139:Z139&ranges=A140:Z140&ranges=A141:Z141&ranges=A142:Z142&ranges=A143:Z143&ranges=A144:Z144&ranges=A145:Z145&ranges=A146:Z146&ranges=A147:Z147&ranges=A148:Z148&ranges=A149:Z149&ranges=A150:Z150&ranges=A151:Z151&ranges=A152:Z152&ranges=A153:Z153&ranges=A154:Z154&ranges=A155:Z155&ranges=A156:Z156&ranges=A157:Z157&ranges=A158:Z158&ranges=A159:Z159&ranges=A160:Z160&ranges=A161:Z161&ranges=A162:Z162&ranges=A163:Z163&ranges=A164:Z164&ranges=A165:Z165&ranges=A166:Z166&ranges=A167:Z167&ranges=A168:Z168&ranges=A169:Z169&ranges=A170:Z170&ranges=A171:Z171&ranges=A172:Z172&ranges=A173:Z173&ranges=A174:Z174&ranges=A175:Z175&ranges=A176:Z176&ranges=A177:Z177&ranges=A178:Z178&ranges=A179:Z179&ranges=A180:Z180&ranges=A181:Z181&ranges=A182:Z182&ranges=A183:Z183&ranges=A184:Z184&ranges=A185:Z185&ranges=A186:Z186&ranges=A187:Z187&ranges=A188:Z188&ranges=A189:Z189&ranges=A190:Z190&ranges=A191:Z191&ranges=A192:Z192&ranges=A193:Z193&ranges=A194:Z194&ranges=A195:Z195&ranges=A196:Z196&ranges=A197:Z197&ranges=A198:Z198&ranges=A199:Z199&ranges=A200:Z200&ranges=A201:Z201&ranges=A202:Z202&ranges=A203:Z203&ranges=A204:Z204&ranges=A205:Z205&ranges=A206:Z206&ranges=A207:Z207&ranges=A208:Z208&ranges=A209:Z209&ranges=A210:Z210&ranges=A211:Z211&ranges=A212:Z212&ranges=A213:Z213&ranges=A214:Z214&ranges=A215:Z215&ranges=A216:Z216&ranges=A217:Z217&ranges=A218:Z218&ranges=A219:Z219&ranges=A220:Z220&ranges=A221:Z221&ranges=A222:Z222&ranges=A223:Z223&ranges=A224:Z224&ranges=A225:Z225&ranges=A226:Z226&ranges=A227:Z227&ranges=A228:Z228&ranges=A229:Z229&ranges=A230:Z230&ranges=A231:Z231&ranges=A232:Z232&ranges=A233:Z233&ranges=A234:Z234&ranges=A235:Z235&ranges=A236:Z236&ranges=A237:Z237&ranges=A238:Z238&ranges=A239:Z239&ranges=A240:Z240&ranges=A241:Z241&ranges=A242:Z242&ranges=A243:Z243&ranges=A244:Z244&ranges=A245:Z245&ranges=A246:Z246&ranges=A247:Z247&ranges=A248:Z248&ranges=A249:Z249&ranges=A250:Z250"

Is there anyway to either 1) up the timeout on the GenServer call (defaults to 5 seconds) or 2) perform this query more efficiently so as to not hit the timeout?

Thanks!

Not been able to save data into spreadsheet, google API connection problem

After project setup and configuration, I just wanted to write some row in the spreadsheet and I have started with a simple function like so

def save_to_spreadsheet() do
    {:ok, pid} = GSS.Spreadsheet.Supervisor.spreadsheet("https://docs.google.com/spreadsheets/d/spreadsheet_id/edit?usp=sharing", list_name: "twitter")

    save_to_candy =
      GSS.Spreadsheet.write_rows(pid, ["A2:E2", "A3:F3"], [["1", "2", "3", "4", "5"], ["1", "2", "3", "4", "5", "6"]])

    {:ok, save_to_candy}
  end

but I'm having a problem with google communication, and the result of this is

iex(3)> SpreadSheet.save_to_spreadsheet()
[debug] Limiter Handle events: [{:request, {#PID<0.691.0>, #Reference<0.2766870055.4265345025.186988>}, %GSS.Client.RequestParams{body: "{\"valueInputOption\":\"USER_ENTERED\",\"data\":[{\"values\":[[\"1\",\"2\",\"3\",\"4\",\"5\"]],\"range\":\"candy!A2:E2\",\"majorDimension\":\"ROWS\"},{\"values\":[[\"1\",\"2\",\"3\",\"4\",\"5\",\"6\"]],\"range\":\"candy!A3:F3\",\"majorDimension\":\"ROWS\"}]}", headers: %{"Authorization" => "Bearer ya29.c.Kl62B9wxzC8D8xcBCxhJoI67Z0TjhsDCJeEg6eHu1ytpiHJpNz8vQ5Vk3ZC7J9rV-PcuHChcVIiBnjeD-BnNrdGETZYuhrccLhuT5fAxxRU3mXv7JuvfTre-M8kufTGq"}, method: :post, options: [ssl: [versions: [:"tlsv1.2"]]], url: "https://sheets.googleapis.com/v4/spreadsheets/https://docs.google.com/spreadsheets/d/1XvvLVKqmFEdipxB5uX8Sp0tIAzEevI_F9xeZ1iq1Y1s/edit?usp=sharing/values:batchUpdate"}}]
[debug] Request handle events: %GSS.Client.RequestParams{body: "{\"valueInputOption\":\"USER_ENTERED\",\"data\":[{\"values\":[[\"1\",\"2\",\"3\",\"4\",\"5\"]],\"range\":\"candy!A2:E2\",\"majorDimension\":\"ROWS\"},{\"values\":[[\"1\",\"2\",\"3\",\"4\",\"5\",\"6\"]],\"range\":\"candy!A3:F3\",\"majorDimension\":\"ROWS\"}]}", headers: %{"Authorization" => "Bearer ya29.c.Kl62B9wxzC8D8xcBCxhJoI67Z0TjhsDCJeEg6eHu1ytpiHJpNz8vQ5Vk3ZC7J9rV-PcuHChcVIiBnjeD-BnNrdGETZYuhrccLhuT5fAxxRU3mXv7JuvfTre-M8kufTGq"}, method: :post, options: [ssl: [versions: [:"tlsv1.2"]]], url: "https://sheets.googleapis.com/v4/spreadsheets/https://docs.google.com/spreadsheets/d/1XvvLVKqmFEdipxB5uX8Sp0tIAzEevI_F9xeZ1iq1Y1s/edit?usp=sharing/values:batchUpdate"}
[debug] send_request https://sheets.googleapis.com/v4/spreadsheets/https://docs.google.com/spreadsheets/d/1XvvLVKqmFEdipxB5uX8Sp0tIAzEevI_F9xeZ1iq1Y1s/edit?usp=sharing/values:batchUpdate
[debug] Response {:ok, %HTTPoison.Response{body: "<!DOCTYPE html>\n<html lang=en>\n  <meta charset=utf-8>\n  <meta name=viewport content=\"initial-scale=1, minimum-scale=1, width=device-width\">\n  <title>Error 404 (Not Found)!!1</title>\n  <style>\n    *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}\n  </style>\n  <a href=//www.google.com/><span id=logo aria-label=Google></span></a>\n  <p><b>404.</b> <ins>That’s an error.</ins>\n  <p>The requested URL <code>/v4/spreadsheets/https://docs.google.com/spreadsheets/d/1XvvLVKqmFEdipxB5uX8Sp0tIAzEevI_F9xeZ1iq1Y1s/edit?usp=sharing/values:batchUpdate</code> was not found on this server.  <ins>That’s all we know.</ins>\n", headers: [{"Date", "Thu, 26 Dec 2019 07:47:02 GMT"}, {"Content-Type", "text/html; charset=UTF-8"}, {"Server", "ESF"}, {"Content-Length", "1696"}, {"X-XSS-Protection", "0"}, {"X-Frame-Options", "SAMEORIGIN"}, {"Alt-Svc", "quic=\":443\"; ma=2592000; v=\"46,43\",h3-Q050=\":443\"; ma=2592000,h3-Q049=\":443\"; ma=2592000,h3-Q048=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000"}], request: %HTTPoison.Request{body: "{\"valueInputOption\":\"USER_ENTERED\",\"data\":[{\"values\":[[\"1\",\"2\",\"3\",\"4\",\"5\"]],\"range\":\"candy!A2:E2\",\"majorDimension\":\"ROWS\"},{\"values\":[[\"1\",\"2\",\"3\",\"4\",\"5\",\"6\"]],\"range\":\"candy!A3:F3\",\"majorDimension\":\"ROWS\"}]}", headers: [{"Authorization", "Bearer ya29.c.Kl62B9wxzC8D8xcBCxhJoI67Z0TjhsDCJeEg6eHu1ytpiHJpNz8vQ5Vk3ZC7J9rV-PcuHChcVIiBnjeD-BnNrdGETZYuhrccLhuT5fAxxRU3mXv7JuvfTre-M8kufTGq"}], method: :post, options: [ssl: [versions: [:"tlsv1.2"]]], params: %{}, url: "https://sheets.googleapis.com/v4/spreadsheets/https://docs.google.com/spreadsheets/d/1XvvLVKqmFEdipxB5uX8Sp0tIAzEevI_F9xeZ1iq1Y1s/edit?usp=sharing/values:batchUpdate"}, request_url: "https://sheets.googleapis.com/v4/spreadsheets/https://docs.google.com/spreadsheets/d/1XvvLVKqmFEdipxB5uX8Sp0tIAzEevI_F9xeZ1iq1Y1s/edit?usp=sharing/values:batchUpdate", status_code: 404}}
[error] Google API returned status code: 404. Body: <!DOCTYPE html>
<html lang=en>
  <meta charset=utf-8>
  <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
  <title>Error 404 (Not Found)!!1</title>
  <style>
    *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}
  </style>
  <a href=//www.google.com/><span id=logo aria-label=Google></span></a>
  <p><b>404.</b> <ins>That’s an error.</ins>
  <p>The requested URL <code>/v4/spreadsheets/https://docs.google.com/spreadsheets/d/1XvvLVKqmFEdipxB5uX8Sp0tIAzEevI_F9xeZ1iq1Y1s/edit?usp=sharing/values:batchUpdate</code> was not found on this server.  <ins>That’s all we know.</ins>

{:ok,
 {:error, %GSS.GoogleApiError{message: "invalid google API status code 404"}}}

documentation is fine with explaining how to connect to the Google API which I did, I have my service_account.json with all the data which are read by the app, so I'm a bit confused about what is happening, did you came across this problem? Thanks

Tests aren't consistently passing

Hi @Voronchuk ,

I'm trying to get the tests passing on this library as I want to fix a problem with timeouts being discarded but am unable to do so. I've done the following:

  1. Created a service account on google cloud, and copied this into config/service_account.json
  2. Modified the spreadsheet_id in config/test.exs to point to a spreadsheet which has granted to permissions to the email address specified in service_account.json
  3. Run mix test multiple times....
  4. Added sheets called list sheet and unknown as a couple of the tests appeared to require these and blew up on range checks until I added them

The problem is, I'm consistently getting failures when running mix test, but they're always different ones. Sometimes 2 failures occur, sometimes 3, sometimes 9, but I'm unable to get everything passing consistently.... help!!!

Max rows

Why the max rows is 1000?
We can increase this value?

Doubts

There's a way to get entire worksheet to work with another library like, https://github.com/GrandCru/GoogleSheets ??

An for get the sheet ID's, there's a way to get ids from drive folder using API??

What we need to make this work?

Thanks in advance.

Make the test spreadsheet public to read and copy

I want to contribute to this library (in particular, I want to have more options to authenticate with goth). So I'm trying to run the tests, but the spreadsheet configured on the test is not accessible.

I know you can't open it as public to write (for evident reasons), but if you share this as public/read and copy, we can duplicate it and run the tests over this copy, making it easy for contributions.

What do you think?

dynamically save data to spreadsheet

Hey, how can someone dynamically save data into the spreadsheet, current example which I'm running will save the data in 20 rows

def save_to_spreadsheet(handle, start_after_tweet \\ 0) do
    {:ok, pid} = GSS.Spreadsheet.Supervisor.spreadsheet("11s", 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_row(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

but every time I save it again it will just override the last save, so what will be the proper way of overcoming this obstacle? Thanks

Conflicting httpoison versions

Can you do a release by any chance? I have this error when trying to use this lib:

Failed to use "httpoison" (version 1.5.0) because
  elixir_google_spreadsheets (versions 0.1.9 and 0.1.10) requires ~> 0.12
  mix.lock specifies 1.5.0

Looks like the fix is in master already.

Thanks!

no process

I just tried to test the library:

My module:

defmodule Test do
@moduledoc
def sheet do
{:ok, pid} = GSS.Spreadsheet.Supervisor.spreadsheet("1bcsjIf1vzKiIaCf2CKS9mac4KU6eRtEnPbkPAOgKc2s")
id = GSS.Spreadsheet.id(pid)
IO.inspect id
end end

in iex -S mix:

Test.sheet ** (exit) exited in: GenServer.call(GSS.Spreadsheet.Supervisor, {:start_child, ["1bcsjIf1vzKiIaCf2CKS9mac4KU6eRtEnPbkPAOgKc2s"]}, :infinity) ** (EXIT) no process (elixir) lib/gen_server.ex:596: GenServer.call/3 (elixir_google_spreadsheets) lib/elixir_google_spreadsheets/spreadsheet/supervisor.ex:16: GSS.Spreadsheet.Supervisor.spreadsheet/2 (test_sheets) lib/test_sheets/test.ex:4: Test.sheet/0

Read/Write from different sheets

Would be awesome to be able to read/write to different sheets. I didn't see if there was a way to do that in the current implementation though.

Should error tuples return exception atoms or structs?

Currently in GSS.Spreadsheet, the type @type spreadsheet_response :: {:json, map()} | {:error, Exception.t} | no_return() specifies that functions return an error tuple with an Exception struct.

However, in the code (e.g. here), the return value is actually {:error, GSS.GoogleApiError} where GSS.GoogleApiError is an atom corresponding to the module and not the struct %GSS.GoogleApiError{}.

I submitted a PR here which corrects some of the instances of Exception.t to be atoms so that dialyzer is able to correctly type check. This isn't a complete solution - it may be better to convert all of the returns to the respective struct if that is what was intended.

Support to Delete Rows

Would you be interested in implementing a feature to delete (many) rows?

Eventually I'd also need to delete cols. And/or resize dimensions of a sheet/grid if that's possible at all. But this is certainly future for me.

Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.