jpillora / node-edit-google-spreadsheet

A simple API for editing Google Spreadsheets
304 stars 101 forks source link

Text cells starting with a numeric character get interpreted as a numeric formatted cell #22

Closed connos closed 10 years ago

connos commented 10 years ago

Hello,

We have an issue with node-edit-google-spreadsheet.

This cell in our google spreadsheet:

1. March 2011: Protests begin

Get changed into this:

1

But when we change the cell to this:

hello 1. March 2011: Protests begin

It outputs correctly.

Are you able to fix this or recommend a solution?

This node project is really good, we're using it at the BBC to help us make the News website. :-)

Thanks, Steve C & Tom M.

jpillora commented 10 years ago

Hey guys

For the time being you can insert

//ensure that the string is *only* a number
if(!/^\-?\d+(\.\d+)?$/.test(obj)) return obj;

above this line: https://github.com/jpillora/node-edit-google-spreadsheet/blob/stable/lib/util.js#L7

I guess this is a bug though I'm not sure if people are relying on this now lol :O

Might just put this in next release anyway :)

Cheers Jaime

connos commented 10 years ago

That works great. Thanks v much Jaime

Steve C & Tom M

jpillora commented 10 years ago

Glad it's being put to good use :)

On Thu, Feb 27, 2014 at 12:02 AM, Steven Connor notifications@github.comwrote:

That works great. Thanks v much Jaime

Steve C & Tom M

Reply to this email directly or view it on GitHubhttps://github.com/jpillora/node-edit-google-spreadsheet/issues/22#issuecomment-36122221 .