Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

OT: Managing (PHP) data pasted into a textarea from Excel

LEGEND ,
Sep 22, 2006 Sep 22, 2006
Folks:

I want to collect lists of numbers from clients. I want them to be able to
select their list in an Excel file, paste it into a textarea, and load those
numbers into an array on the backend. I can see that the numbers from the
excel file paste into the clipboard as <number><newline> pairs. What would
be the best way to persuade this textarea's contents into an array with PHP?

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================



TOPICS
Server side applications
457
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 22, 2006 Sep 22, 2006
Perhaps explode that puppy?

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
news:ef1ev6$deb$1@forums.macromedia.com...
> Folks:
>
> I want to collect lists of numbers from clients. I want them to be able
> to select their list in an Excel file, paste it into a textarea, and load
> those numbers into an array on the backend. I can see that the numbers
> from the excel file paste into the clipboard as <number><newline> pairs.
> What would be the best way to persuade this textarea's contents into an
> array with PHP?
>
> --
> Murray --- ICQ 71997575
> Adobe Community Expert
> (If you *MUST* email me, don't LAUGH when you do so!)
> ==================
> http://www.dreamweavermx-templates.com - Template Triage!
> http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
> http://www.dwfaq.com - DW FAQs, Tutorials & Resources
> http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
> ==================
>
>
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 22, 2006 Sep 22, 2006
it looks like excel breaks the columns by tab and the rows by new line. try processing the text control data with this:

//explode the rows on 'new line'
$rows=explode(chr(10),$_POST['text']);
$i=0;
foreach ($rows as $value) {
//explode the columns on 'tab'
$sheet[$i]=explode(chr(9),$value);
$i++;
}
//sheet is an multidimensional array
//use like $sheet[row][column]
//note that the rows and columns start with 0!
//sample:
echo "Row 1 - Column 3=".$sheet[0][2];

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 22, 2006 Sep 22, 2006
LATEST
Thanks - in this case, there was only a single column, so
$array=explode($_POST['field']); was all I needed!

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"digitalus media" <webforumsuser@macromedia.com> wrote in message
news:ef1na5$n4v$1@forums.macromedia.com...
> it looks like excel breaks the columns by tab and the rows by new line.
> try
> processing the text control data with this:
>
> //explode the rows on 'new line'
> $rows=explode(chr(10),$_POST['text']);
> $i=0;
> foreach ($rows as $value) {
> //explode the columns on 'tab'
> $sheet[$i]=explode(chr(9),$value);
> $i++;
> }
> //sheet is an multidimensional array
> //use like $sheet[row][column]
> //note that the rows and columns start with 0!
> //sample:
> echo "Row 1 - Column 3=".$sheet[0][2];
>
>
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines